Skip to content

Commit

Permalink
cmd/completion: Add prefix to command to hide it better
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryMichal committed May 13, 2022
1 parent e80cba4 commit 4469774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions completion/generate_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

if len(sys.argv) != 3:
print('{}: wrong arguments'.format(sys.argv[0]), file=sys.stderr)
print('Usage: {} [SOURCE DIR] [COMPLETION TYPE]'.format(sys.argv[0]), file=sys.stderr)
print('Usage: {} [SOURCE DIR] [COMPLETION TYPE]'.format(
sys.argv[0]), file=sys.stderr)
print()
print("SOURCE DIR is path to the Toolbox Go source code")
print("COMPLETION TYPE is either 'bash', 'zsh' or 'fish'")
Expand All @@ -33,9 +34,11 @@

try:
os.chdir(source_dir)
output = subprocess.run(['go', 'run', '.', 'completion', completion_type], check=True)
output = subprocess.run(
['go', 'run', '.', '__completion', completion_type], check=True)
except subprocess.CalledProcessError as e:
print('{}: go run returned non-zero exit status {}'.format(sys.argv[0], e.returncode), file=sys.stderr)
print('{}: go run returned non-zero exit status {}'.format(
sys.argv[0], e.returncode), file=sys.stderr)
sys.exit(e.returncode)

sys.exit(0)
2 changes: 1 addition & 1 deletion src/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Use: "__completion [bash|zsh|fish|powershell]",
Short: "Generate completion script",
Long: `To load completions:
Expand Down

0 comments on commit 4469774

Please sign in to comment.