jhult opened a new pull request, #259:
URL: https://github.com/apache/skywalking-eyes/pull/259

   ### Bug
   
   Fish completion script has an `INFO` log message at the start of the file, 
which breaks the shell script syntax:
   
   ```sh
   INFO Loading configuration from file: .licenserc.yaml
   # fish completion for license-eye...
   ```
   
   This causes fish to error: `'end' outside of a block` when sourcing the 
completion file. Example:
   
   ```sh
   ❯ license-eye header 
/opt/homebrew/share/fish/vendor_completions.d/license-eye.fish (line 39): 'end' 
outside of a block
       end
       ^~^
   from sourcing file 
/opt/homebrew/share/fish/vendor_completions.d/license-eye.fish
   source: Error while reading file 
['/opt/homebrew/share/fish/vendor_completions.d/license-eye.fish'](url)
   ```
   
   ### Root Cause
   
   The `PersistentPreRunE` hook in `commands/root.go` loads the config file, 
which logs an INFO message before the completion script is generated. When 
running `license-eye completion fish`, the config loading happens before 
outputting the completion script.
   
   The issue manifests in two ways:
   
   1. When generating the completion file directly
   2. During actual completion when cobra internally calls `__complete` command
   
   ### Fix
   
   Skip config loading in `PersistentPreRunE` for both:
   
   - The `completion` parent command
   - The `__complete` command used internally by cobra


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to