Changes between Version 5 and Version 6 of BashCommandCompletion


Ignore:
Timestamp:
Apr 30, 2008, 1:04:57 AM (17 years ago)
Author:
fthomas
Comment:

use the new names for the client and command line tool

Legend:

Unmodified
Added
Removed
Modified
  • BashCommandCompletion

    v5 v6  
    1 = Command completion for boinc_client and boinc_cmd =
     1= Command completion for boinc and boinccmd =
    22
    3 The bash shell has a useful facility to complete commands when you press [TAB]. There is a script which goes a bit further and lets bash complete [UnixClient boinc_client's] and [BoincCmd boinc_cmd's] commands and options.
     3The bash shell has a useful facility to complete commands when you press `[TAB]`. There is a script which goes a bit further and lets bash complete [UnixClient boinc's] and [BoincCmd boinccmd's] commands and options.
    44
    5 For example if you type '''boinc_cmd --get_[TAB]''' it gives you all commands which begin with --get_:
     5For example if you type '''`boinccmd --get_[TAB]`''' it gives you all commands which begin with `--get_`:
    66{{{
     7~$ boinccmd --get_
    78--get_cc_status            --get_project_status
    89--get_disk_usage           --get_proxy_settings
     
    1314--get_project_config_poll
    1415}}}
    15 If you now press 'p' the selection is reduced to:
     16If you now press `p` and then `[TAB]` again the selection is reduced to:
    1617{{{
     18~$ boinccmd --get_pro
    1719--get_project_config       --get_project_status
    1820--get_project_config_poll  --get_proxy_settings
    1921}}}
    20 and so on. The script also completes host names after the --host option.
     22and so on. The script also completes host names after the `--host` option.
    2123
    22 To use this command completion, save the following script on a file and source it in bash.
     24To use this command completion, save the following script on a file (e.g. `boinc.bash`) and source it in bash:
    2325{{{
    24 #!comment
    25 instructions are needed on what exactly users are supposed to do to use the script, ie what "source it in bash" means.
     26~$ source boinc.bash
    2627}}}
     28
    2729----
     30
    2831{{{
    2932#!bash
    3033# Source this file in bash to get command completion (using tab)
    31 # for boinc_client and boinc_cmd
     34# for boinc and boinccmd
    3235# Written by Frank S. Thomas
    3336
    34 _boinc_client()
     37_boinc()
    3538{
    3639    local cur prev opts
     
    3942    prev="${COMP_WORDS[COMP_CWORD-1]}"
    4043
    41     opts="$(boinc_client --help | \
     44    opts="$(boinc --help | \
    4245        sed -n -r 's/^[[:space:]]*(--[a-z_]*).*/\1/p')"
    4346
     
    6669    fi
    6770}
    68 complete -F _boinc_client -o default boinc_client
     71complete -F _boinc -o default boinc
    6972
    70 _boinc_cmd()
     73_boinccmd()
    7174{
    7275    local cur prev opts cmds
     
    7679
    7780    opts="--host --passwd -h --help -V --version"
    78     cmds="$(boinc_cmd --help 2>&1 | \
     81    cmds="$(boinccmd --help 2>&1 | \
    7982        sed -n -r 's/^[[:space:]]*(--[a-z_]*).*/\1/p')"
    8083
     
    124127    esac
    125128}
    126 complete -F _boinc_cmd boinc_cmd
     129complete -F _boinccmd boinccmd
    127130# vim: syntax=sh
    128131}}}