All Projects → dim-an → Cod

dim-an / Cod

Licence: apache-2.0
cod is a completion daemon for bash/fish/zsh

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
bash
514 projects

Projects that are alternatives of or similar to Cod

Powerline Go
A beautiful and useful low-latency prompt for your shell, written in go
Stars: ✭ 2,299 (+698.26%)
Mutual labels:  zsh, fish
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+1435.42%)
Mutual labels:  zsh, fish
Kafkactl
Command Line Tool for managing Apache Kafka
Stars: ✭ 177 (-38.54%)
Mutual labels:  zsh, fish
Gh
Easily manage your local git repos
Stars: ✭ 156 (-45.83%)
Mutual labels:  zsh, fish
carapace-bin
multi-shell multi-command argument completer
Stars: ✭ 42 (-85.42%)
Mutual labels:  zsh, fish
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (+651.39%)
Mutual labels:  zsh, fish
Shellder
🐚 Featured zsh/fish shell theme
Stars: ✭ 192 (-33.33%)
Mutual labels:  zsh, fish
Dotfiles
If there is a shell, there is a way!
Stars: ✭ 112 (-61.11%)
Mutual labels:  zsh, fish
config
Fig's integrations with bash, zsh, fish, ssh, and tmux. Also contains Fig's installation and update scripts. Finally, this repo is the root of the .fig folder that is installed on your computer when you download Fig!
Stars: ✭ 44 (-84.72%)
Mutual labels:  zsh, fish
Starship
☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!
Stars: ✭ 20,504 (+7019.44%)
Mutual labels:  zsh, fish
Up
Quickly navigate to a parent directory via tab-completion.
Stars: ✭ 126 (-56.25%)
Mutual labels:  zsh, fish
tii
Command not found? Install it right there!
Stars: ✭ 27 (-90.62%)
Mutual labels:  zsh, fish
Fzf Tab Completion
Tab completion using fzf
Stars: ✭ 127 (-55.9%)
Mutual labels:  zsh, completion
Powerline
Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.
Stars: ✭ 12,989 (+4410.07%)
Mutual labels:  zsh, fish
Xxh
🚀 Bring your favorite shell wherever you go through the ssh.
Stars: ✭ 2,559 (+788.54%)
Mutual labels:  zsh, fish
Gitmux
💻 Git in your tmux status bar
Stars: ✭ 180 (-37.5%)
Mutual labels:  zsh, fish
Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+14123.96%)
Mutual labels:  zsh, fish
Forgit
💤 A utility tool powered by fzf for using git interactively.
Stars: ✭ 1,823 (+532.99%)
Mutual labels:  zsh, fish
Silver
A cross-shell customizable powerline-like prompt with icons
Stars: ✭ 238 (-17.36%)
Mutual labels:  zsh, fish
hoard
cli command organizer written in rust
Stars: ✭ 71 (-75.35%)
Mutual labels:  zsh, fish

[[https://github.com/dim-an/cod/actions][file:https://github.com/dim-an/cod/workflows/Go/badge.svg]]

Cod is a completion daemon for ={bash,fish,zsh}=.

It detects usage of =--help= commands parses their output and generates auto-completions for your shell.

[[https://asciinema.org/a/h0SrrNvZVcqoSM4DNyEUrGtQh][file:https://asciinema.org/a/h0SrrNvZVcqoSM4DNyEUrGtQh.svg]]

  • Install [[https://github.com/dim-an/cod/releases][Download]] or [[#Build][build]] =cod= binary for your OS and put it into your =$PATH=.

    Then you need to edit your init script and add few lines.

** Bash Add to =~/.bashrc= #+BEGIN_SRC source <(cod init $$ bash) #+END_SRC

** Zsh Add to =~/.zshrc= #+BEGIN_SRC source <(cod init $$ zsh) #+END_SRC

** Fish Add to =~/.config/fish/config.fish= #+BEGIN_SRC cod init %self fish | source #+END_SRC

  • Supported shells and operating systems =cod= is known to work with latest version of =zsh= (tested: =v5.5.1= and =5.7.1=) on macOS and Linux.

    =cod= also works with with latest version of =bash= (tested: =4.4.20= and =v5.0.11=) on Linux.

    Note that default =bash= that is bundled with macOS is too old and =cod= doesn't support it.

    =cod= works with latest version of =fish= (tested: =v3.1.2") on Linux (I didn't have a chance to test it on macOS).

  • Build [[https://golang.org/dl/][Go v1.16]] is recommended.

    #+BEGIN_SRC git clone https://github.com/dim-an/cod.git cd cod go build #+END_SRC

    or

    #+BEGIN_SRC go get -u github.com/dim-an/cod #+END_SRC

  • Overview Cod checks each command you run in the shell. When cod detects usage of =--help= flag it asks if you want it to learn this command. If you choose to allow cod to learn this command cod will run command itself parse the output and generate completions based on the =--help= output.

** How cod detects help commands Cod performs following checks to decide if command is help invocation:

  • checks if =--help= flag is used;
  • checks that command is simple i.e. doesn't contain any pipes, file descriptor redirections, and other shell magic;
  • checks that command exit code is 0.

If cod cannot automatically detect that your command is help invocation you can use =learn= subcommand to learn this command anyway.

** How cod runs help commands Cod always uses absolute paths to run program. (So it finds binary in =PATH= or resolves relative path if required). Other arguments except binary path are left unchanged.

Current shell environment and current shell working directory will be used.

If program is successfully executed cod will store: - absolute path to binary; - used arguments; - working directory; - environment variables. This info will be used to update command if required (check: =cod help update=).

** How cod parses help output =cod= has generic parser that works with most of help pages and recognizes flags (starting with =-=) but doesn't recognize subcommands.

It also has a special parser tuned for [[https://docs.python.org/library/argparse.html][python argparse library]] that recognizes flags and subcommands.

  • Configuration Cod will search config in =$XDG_CONFIG_HOME/cod/config.toml= file (default: =~/.config/cod/config.toml=).

    Config file allows to specify rules to ignore executables or always trust them.

    =cod example-config= prints example configuration to stdout. =cod example-config --create= writes example configuration to proper config file.

  • Data directories Cod uses =$XDG_DATA_HOME/cod= (default: =~/.local/share/cod=) to store all generated data files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].