Skip to content

Instantly share code, notes, and snippets.

@jagajaga
Created July 2, 2015 22:39
Show Gist options
  • Select an option

  • Save jagajaga/2abbf5b4bde65a6549ac to your computer and use it in GitHub Desktop.

Select an option

Save jagajaga/2abbf5b4bde65a6549ac to your computer and use it in GitHub Desktop.

Revisions

  1. jagajaga created this gist Jul 2, 2015.
    29 changes: 29 additions & 0 deletions _gshell
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #compdef gshell

    _gshell() {
        local curcontext="$curcontext" state line
        typeset -A opt_args

        _arguments \
            '1: :->action'\
            '*: :->folder'

        case $state in
        action)
            _arguments '1:Action:(init enter on off checkout enterRev log rollback graph push pull clear)'
        ;;
        *)
            case $words[2] in
            checkout)
    local -a revisions
    revisions=`gshell log`
                compadd "$@" $revisions
            ;;
            *)
                _files
    ;;
            esac
        esac
    }

    _gshell "$@"