abra autocomplete setup difficulties #490

Closed
opened 2025-01-22 11:26:26 +00:00 by simon · 9 comments
Member

First of all, autocompletion has a quite weird behavior when just upgrading abra, starting the Error message in the middle of the line:

abra app ps -C pretError: unknown flag: --generate-bash-completion
Usage:
  abra app ps <domain> [flags]

Plus, setting up autocompletion under bash wasn't as easy as abra autocomplete --help suggested here:

sth@DESKTOP-PH8ENDF:~$ abra autocomplete --help
To load completions:

Bash:

  $ source <(abra autocomplete bash)

  # To load autocompletion for each session, execute once:
  # Linux:
  $ abra autocomplete bash > /etc/bash_completion.d/abra
  # macOS:
  $ abra autocomplete bash > $(brew --prefix)/etc/bash_completion.d/abra

tried this:

sth@DESKTOP-PH8ENDF:~$ abra autocomplete bash > /etc/bash_completion.d/abra
bash: /etc/bash_completion.d/abra: Permission denied

Asked chatGPT on it and this worked for me:

Solution 2: Local Storage and Sourcing

If writing to /etc/bash_completion.d/ is not possible, save the autocomplete file in your home directory and load it manually:

abra autocomplete bash > ~/.abra_bash_completion
source ~/.abra_bash_completion

To make the autocomplete available every time you start a new session, add the following line to your ~/.bashrc:

source ~/.abra_bash_completion

Reload the ~/.bashrc file to apply the changes:

source ~/.bashrc

Maybe its due to my setup with Windows and Linux Subsystem (WSL)? Can anyone else verify?

First of all, autocompletion has a quite weird behavior when just upgrading abra, starting the Error message in the middle of the line: ``` abra app ps -C pretError: unknown flag: --generate-bash-completion Usage: abra app ps <domain> [flags] ``` Plus, setting up autocompletion under bash wasn't as easy as `abra autocomplete --help` suggested here: ``` sth@DESKTOP-PH8ENDF:~$ abra autocomplete --help To load completions: Bash: $ source <(abra autocomplete bash) # To load autocompletion for each session, execute once: # Linux: $ abra autocomplete bash > /etc/bash_completion.d/abra # macOS: $ abra autocomplete bash > $(brew --prefix)/etc/bash_completion.d/abra ``` tried this: ``` sth@DESKTOP-PH8ENDF:~$ abra autocomplete bash > /etc/bash_completion.d/abra bash: /etc/bash_completion.d/abra: Permission denied ``` Asked chatGPT on it and this worked for me: > ### Solution 2: Local Storage and Sourcing > > If writing to /etc/bash\_completion.d/ is not possible, save the autocomplete file in your home directory and load it manually: > > ``` > abra autocomplete bash > ~/.abra_bash_completion > source ~/.abra_bash_completion > ``` > > To make the autocomplete available every time you start a new session, add the following line to your ~/.bashrc: > > ``` > source ~/.abra_bash_completion > ``` > > Reload the ~/.bashrc file to apply the changes: > > ``` > source ~/.bashrc > ``` Maybe its due to my setup with Windows and Linux Subsystem (WSL)? Can anyone else verify?
Owner

@simon in the latest git main version of abra, the --help output has a different command which should work around the permissions issue:

abra autocomplete bash | sudo tee /etc/bash_completion.d/abra

Does that also work OK for you?

@simon in the latest git main version of abra, the `--help` output has a different command which should work around the permissions issue: `abra autocomplete bash | sudo tee /etc/bash_completion.d/abra` Does that also work OK for you?
Owner

Additional links below. Please let us know @simon, thanks!

#475

cli/complete.go Lines 9 to 46 in 8a7fe4ca07
var AutocompleteCommand = &cobra.Command{
Use: "autocomplete [bash|zsh|fish|powershell]",
Short: "Generate autocompletion script",
Long: `To load completions:
Bash:
# Load autocompletion for the current Bash session
$ source <(abra autocomplete bash)
# To load autocompletion for each session, execute once:
# Linux:
$ abra autocomplete bash | sudo tee /etc/bash_completion.d/abra
# macOS:
$ abra autocomplete bash | sudo tee $(brew --prefix)/etc/bash_completion.d/abra
Zsh:
# If shell autocompletion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
# To load autocompletions for each session, execute once:
$ abra autocomplete zsh > "${fpath[1]}/_abra"
# You will need to start a new shell for this setup to take effect.
fish:
$ abra autocomplete fish | source
# To load autocompletions for each session, execute once:
$ abra autocomplete fish > ~/.config/fish/completions/abra.fish
PowerShell:
PS> abra autocomplete powershell | Out-String | Invoke-Expression
# To load autocompletions for every new session, run:
PS> abra autocomplete powershell > abra.ps1
# and source this file from your PowerShell profile.`,

Additional links below. Please let us know @simon, thanks! https://git.coopcloud.tech/toolshed/abra/pulls/475 https://git.coopcloud.tech/toolshed/abra/src/commit/8a7fe4ca07df7bf94fb897271e29fd7605595ace/cli/complete.go#L9-L46
decentral1se added the
question
label 2025-02-05 13:49:23 +00:00
decentral1se added this to the abra v0.10.0 project 2025-02-11 15:22:05 +00:00
decentral1se added the
release-candidate
label 2025-02-12 14:56:44 +00:00
Owner

(Please re-open if the issue persists)

(Please re-open if the issue persists)
Owner

This is still an issue on the latest RC

This is still an issue on the latest RC
Owner
abra autocomplete bash | sudo tee /etc/bash_completion.d/abra

This doesn't work for some reason (Debian 12 and Fedora 41).? afaik it should do.

The solution Simon suggested "Solution 2: Local Storage and Sourcing" works for me, modding the bashrc. I reckon we should probably make sure all the autocomplete commands work for all shells

``` abra autocomplete bash | sudo tee /etc/bash_completion.d/abra ``` This doesn't work for some reason (Debian 12 and Fedora 41).? afaik it should do. The solution Simon suggested "Solution 2: Local Storage and Sourcing" works for me, modding the bashrc. I reckon we should probably make sure all the autocomplete commands work for all shells
Owner

Have confirmed abra autocomplete fish and abra autocomplete zsh also don't work on abra version 0.10.0-rc1-beta-8af87aa

Have confirmed `abra autocomplete fish` and `abra autocomplete zsh` also don't work on `abra version 0.10.0-rc1-beta-8af87aa`
Owner

@kawaiipunk any logs or hints? if i can't reproduce it, i can't fix it.

@kawaiipunk any logs or hints? if i can't reproduce it, i can't fix it.
Owner

@3wordchant said in chat that was fixed on git main branch but not in the RC?

It's very confusing when there's stable, RC and git main. Are you on the current RC @decentral1se ? you should be able to recreate.

@3wordchant said in chat that was fixed on git main branch but not in the RC? It's very confusing when there's stable, RC and git main. Are you on the current RC @decentral1se ? you should be able to recreate.
Owner

@kawaiipunk

This was fixed after the release candidate as shown in #490 (comment). This will be released for testing when we get the new release candidate out (currently stalled due to lack of capacity).

This doesn't work for some reason

I can't recreate "doesn't work for some reason", can you please send us the logs of the error? Run abra autocomplete bash | sudo tee /etc/bash_completion.d/abra again and tell us what comes back.

@kawaiipunk This was fixed after the release candidate as shown in https://git.coopcloud.tech/toolshed/abra/issues/490#issuecomment-22731. This will be released for testing when we get the new release candidate out (currently stalled due to lack of capacity). > This doesn't work for some reason I can't recreate "doesn't work for some reason", can you please send us the logs of the error? Run `abra autocomplete bash | sudo tee /etc/bash_completion.d/abra` again and tell us what comes back.
decentral1se moved this to Done in abra v0.10.0 on 2025-04-14 22:00:59 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-14 22:01:01 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-16 05:16:08 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-16 05:16:10 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-19 07:28:29 +00:00
decentral1se moved this to Done in abra v0.10.0 on 2025-04-21 17:48:16 +00:00
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/abra#490
No description provided.