File: keep.zsh

package info (click to toggle)
python-keep 2.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: python: 542; sh: 25; makefile: 3
file content (53 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#compdef _keep keep

function _keep {
  local -a commands

  _arguments -C \
    "-v[Enables verbose mode]:" \
    "--verbose[Enables verbose mode]:" \
    "--help[Show the help message and exit]:" \
    "1: :->cmnds" \
    "*::arg:->args"
  case $state in
  cmnds)
    commands=(
      "edit:Edit a saved command."
      "github_token:Register a GitHub Token to use GitHub Gists as a backup."
      "grep:Searches for a saved command."
      "init:Initializes the CLI."
      "list:Shows the saved commands."
      "new:Saves a new command."
      "pull:Pull commands from saved GitHub gist."
      "push:Push commands to a secret GitHub gist."
      "rm:Deletes a saved command."
      "run:Executes a saved command."
      "update:Check for an update of Keep."
    )
    _describe "command" commands
    ;;
  esac

  case "$words[1]" in
  edit)
    _keep_edit
    ;;
  rm)
    _keep_commands
    ;;
  run)
    _keep_commands
    ;;
  esac
}

function _keep_edit {
  _arguments \
    "--editor[Editor to use]"
}

function _keep_commands {
  local -a commands
  commands=("${(@f)$(keep completion --zsh)}")
  _describe "command" commands
}