-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Lines 287 to 291 in 7762c51
| // Aliases | |
| aliases, err := exec.Command("bash", "-ic", "compgen -a").Output() | |
| if err != nil { | |
| return nil, fmt.Errorf("could not get aliases: %w", err) | |
| } |
This call to bash fails if there are no bash aliases because compgen shell builtin returns non-zero error code if it can't find results.
From man bash:
compgen [option] [word]
Generate possible completion matches for word according to the options, which may be any option accepted by the complete builtin with the exception of -p and -r, and write the matches to the standard output. When using the
-F or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful values.
The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word
will be displayed.
The return value is true unless an invalid option is supplied, or no matches were generated. # <=== hereThe same error is thrown on similar calls of compgen in the same file such as for functions. This prevents running sol -all on a clean bash setup without aliases and functions defined.
Possibly useful version information:
$ bash --version
GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu)
$ go version
go version go1.23.0 linux/amd64Metadata
Metadata
Assignees
Labels
No labels