Skip to content

Commit

Permalink
refactor: cli help and shell completions (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Jun 23, 2024
1 parent b3bec3c commit bce2dbe
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Options:
-c, --code Output code only
-f, --file <FILE> Include files with the message
-H, --no-highlight Turn off syntax highlighting
-S, --no-stream Turns off stream mode
-S, --no-stream Turn off stream mode
-w, --wrap <WRAP> Control text wrapping (no, auto, <max-width>)
--light-theme Use light theme
--dry-run Display the message without sending it
Expand Down
2 changes: 1 addition & 1 deletion scripts/completions/aichat.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _aichat() {

case "${cmd}" in
aichat)
opts="-m -r -s -a -R -e -c -f -H -S -w -h -V --model --prompt --role --session --save-session --agent --rag --serve --execute --code --file --no-highlight --no-stream --wrap --light-theme --dry-run --info --list-models --list-roles --list-sessions --list-agents --list-rags --help --version"
opts="-m -r -s -a -R -e -c -f -S -w -H -h -V --model --prompt --role --session --save-session --agent --rag --serve --execute --code --file --no-stream --wrap --no-highlight --light-theme --dry-run --info --list-models --list-roles --list-sessions --list-agents --list-rags --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down
6 changes: 3 additions & 3 deletions scripts/completions/aichat.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ complete -c aichat -s s -l session -x -a"(aichat --list-sessions)" -d 'Start or
complete -c aichat -l save-session -d 'Forces the session to be saved'
complete -c aichat -s a -l agent -x -a"(aichat --list-agents)" -d 'Start a agent' -r
complete -c aichat -s R -l rag -x -a"(aichat --list-rags)" -d 'Start a RAG' -r
complete -c aichat -s f -l file -d 'Include files with the message' -r -F
complete -c aichat -s w -l wrap -d 'Control text wrapping (no, auto, <max-width>)'
complete -c aichat -l serve -d 'Serve the LLM API and WebAPP'
complete -c aichat -s e -l execute -d 'Execute commands in natural language'
complete -c aichat -s c -l code -d 'Output code only'
complete -c aichat -s f -l file -d 'Include files with the message' -r -F
complete -c aichat -s S -l no-stream -d 'Turn off stream mode'
complete -c aichat -s w -l wrap -d 'Control text wrapping (no, auto, <max-width>)'
complete -c aichat -s H -l no-highlight -d 'Turn off syntax highlighting'
complete -c aichat -s S -l no-stream -d 'Turns off stream mode'
complete -c aichat -l light-theme -d 'Use light theme'
complete -c aichat -l dry-run -d 'Display the message without sending it'
complete -c aichat -l info -d 'Display information'
Expand Down
50 changes: 25 additions & 25 deletions scripts/completions/aichat.nu
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ module completions {

# All-in-one chat and copilot CLI that integrates 10+ AI platforms
export extern aichat [
--model(-m): string@"nu-complete aichat model" # Select a LLM model
--prompt # Use the system prompt
--role(-r): string@"nu-complete aichat role" # Select a role
--session(-s): string@"nu-complete aichat role" # Start or join a session
--save-session # Forces the session to be saved
--agent(-a): string@"nu-complete aichat agent" # Start a agent
--rag(-R): string@"nu-complete aichat rag" # Start a RAG
--serve # Serve the LLM API and WebAPP
--execute(-e) # Execute commands in natural language
--code(-c) # Output code only
--file(-f): string # Include files with the message
--no-highlight(-H) # Turn off syntax highlighting
--no-stream(-S) # Turns off stream mode
--wrap(-w): string # Control text wrapping (no, auto, <max-width>)
--light-theme # Use light theme
--dry-run # Display the message without sending it
--info # Display information
--list-models # List all available chat models
--list-roles # List all roles
--list-sessions # List all sessions
--list-agents # List all agents
--list-rags # List all RAGs
...text: string # Input text
--help(-h) # Print help
--version(-V) # Print version
--model(-m): string@"nu-complete aichat model" # Select a LLM model
--prompt # Use the system prompt
--role(-r): string@"nu-complete aichat role" # Select a role
--session(-s): string@"nu-complete aichat session" # Start or join a session
--save-session # Forces the session to be saved
--agent(-a): string@"nu-complete aichat agent" # Start a agent
--rag(-R): string@"nu-complete aichat rag" # Start a RAG
--serve # Serve the LLM API and WebAPP
--execute(-e) # Execute commands in natural language
--code(-c) # Output code only
--file(-f): string # Include files with the message
--no-stream(-S) # Turn off stream mode
--wrap(-w): string # Control text wrapping (no, auto, <max-width>)
--no-highlight(-H) # Turn off syntax highlighting
--light-theme # Use light theme
--dry-run # Display the message without sending it
--info # Display information
--list-models # List all available chat models
--list-roles # List all roles
--list-sessions # List all sessions
--list-agents # List all agents
--list-rags # List all RAGs
...text: string # Input text
--help(-h) # Print help
--version(-V) # Print version
]

}
Expand Down
12 changes: 6 additions & 6 deletions scripts/completions/aichat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ Register-ArgumentCompleter -Native -CommandName 'aichat' -ScriptBlock {
[CompletionResult]::new('--agent', '--agent', [CompletionResultType]::ParameterName, 'Start a agent')
[CompletionResult]::new('-R', '-R', [CompletionResultType]::ParameterName, 'Start a RAG')
[CompletionResult]::new('--rag', '--rag', [CompletionResultType]::ParameterName, 'Start a RAG')
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'Include files with the message')
[CompletionResult]::new('--file', '--file', [CompletionResultType]::ParameterName, 'Include files with the message')
[CompletionResult]::new('-w', '-w', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
[CompletionResult]::new('--wrap', '--wrap', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
[CompletionResult]::new('--serve', '--serve', [CompletionResultType]::ParameterName, 'Serve the LLM API and WebAPP')
[CompletionResult]::new('-e', '-e', [CompletionResultType]::ParameterName, 'Execute commands in natural language')
[CompletionResult]::new('--execute', '--execute', [CompletionResultType]::ParameterName, 'Execute commands in natural language')
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'Output code only')
[CompletionResult]::new('--code', '--code', [CompletionResultType]::ParameterName, 'Output code only')
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'Include files with the message')
[CompletionResult]::new('--file', '--file', [CompletionResultType]::ParameterName, 'Include files with the message')
[CompletionResult]::new('-S', '-S', [CompletionResultType]::ParameterName, 'Turn off stream mode')
[CompletionResult]::new('--no-stream', '--no-stream', [CompletionResultType]::ParameterName, 'Turn off stream mode')
[CompletionResult]::new('-w', '-w', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
[CompletionResult]::new('--wrap', '--wrap', [CompletionResultType]::ParameterName, 'Control text wrapping (no, auto, <max-width>)')
[CompletionResult]::new('-H', '-H', [CompletionResultType]::ParameterName, 'Turn off syntax highlighting')
[CompletionResult]::new('--no-highlight', '--no-highlight', [CompletionResultType]::ParameterName, 'Turn off syntax highlighting')
[CompletionResult]::new('-S', '-S', [CompletionResultType]::ParameterName, 'Turns off stream mode')
[CompletionResult]::new('--no-stream', '--no-stream', [CompletionResultType]::ParameterName, 'Turns off stream mode')
[CompletionResult]::new('--light-theme', '--light-theme', [CompletionResultType]::ParameterName, 'Use light theme')
[CompletionResult]::new('--dry-run', '--dry-run', [CompletionResultType]::ParameterName, 'Display the message without sending it')
[CompletionResult]::new('--info', '--info', [CompletionResultType]::ParameterName, 'Display information')
Expand Down
12 changes: 6 additions & 6 deletions scripts/completions/aichat.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ _aichat() {
'--agent[Start a agent]:AGENT:->agents' \
'-R[Start a RAG]:RAG:->rags' \
'--rag[Start a RAG]:RAG:->rags' \
'*-f[Include files with the message]:FILE:_files' \
'*--file[Include files with the message]:FILE:_files' \
'-w[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
'--wrap[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
'--serve[Serve the LLM API and WebAPP]' \
'-e[Execute commands in natural language]' \
'--execute[Execute commands in natural language]' \
'-c[Output code only]' \
'--code[Output code only]' \
'*-f[Include files with the message]:FILE:_files' \
'*--file[Include files with the message]:FILE:_files' \
'-S[Turn off stream mode]' \
'--no-stream[Turn off stream mode]' \
'-w[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
'--wrap[Control text wrapping (no, auto, <max-width>)]:WRAP: ' \
'-H[Turn off syntax highlighting]' \
'--no-highlight[Turn off syntax highlighting]' \
'-S[Turns off stream mode]' \
'--no-stream[Turns off stream mode]' \
'--light-theme[Use light theme]' \
'--dry-run[Display the message without sending it]' \
'--info[Display information]' \
Expand Down
8 changes: 4 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ pub struct Cli {
/// Include files with the message
#[clap(short = 'f', long, value_name = "FILE")]
pub file: Vec<String>,
/// Turn off syntax highlighting
#[clap(short = 'H', long)]
pub no_highlight: bool,
/// Turns off stream mode
/// Turn off stream mode
#[clap(short = 'S', long)]
pub no_stream: bool,
/// Control text wrapping (no, auto, <max-width>)
#[clap(short = 'w', long)]
pub wrap: Option<String>,
/// Turn off syntax highlighting
#[clap(short = 'H', long)]
pub no_highlight: bool,
/// Use light theme
#[clap(long)]
pub light_theme: bool,
Expand Down

0 comments on commit bce2dbe

Please sign in to comment.