GithubHelp home page GithubHelp logo

fpille / sh-manpage-completions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nevesnunes/sh-manpage-completions

0.0 0.0 0.0 55 KB

Generate bash/zsh completions from man pages

License: GNU General Public License v2.0

Makefile 0.38% Lex 3.86% Python 84.09% C++ 7.86% Shell 3.81%

sh-manpage-completions's Introduction

sh-manpage-completions

Automatically generate bash and zsh completions from man pages.

Uses fish-shell's create_manpage_completions.py to parse the pages, then converts the resulting fish completions.

Example

./run.sh /usr/share/man/man1/tar.1.gz

You can then take the files from completions/$shell/ and use them according to your configuration:

  • Bash: Source them in an initialization file (e.g. ~/.bashrc)
  • Zsh: Add them to a directory in $fpath

Limitations

Bash doesn't support descriptions in completions. There has been some discussion about workarounds. Two different strategies were implemented:

  1. Separate descriptions

Consists on printing the completions with descriptions, before bash displays the completions again. It results in redundancy but doesn't break tab behaviour. Descriptions can be omitted like so:

BASH_NO_DESCRIPTIONS=1 ./run.sh /usr/share/man/man1/tar.1.gz
  1. Filter through a selector

You can use a fuzzy selector to extract the right option, containg both the completion and its description. No redundancy, but relies on an external application. Can be used like so:

BASH_USE_SELECTOR=1 ./run.sh /usr/share/man/man1/tar.1.gz

Uses fzf by default. You can pass another one, optionally with an argument that takes the current input as a query, filtering down the results:

BASH_USE_SELECTOR=1 SELECTOR=fzy SELECTOR_QUERY='-q' ./run.sh /usr/share/man/man1/tar.1.gz

Related Work

License

Files in fish-tools were taken from fish-shell's source code, which is released under the GNU General Public License, version 2 (see LICENSE.GPL2).

The remaining source code is released under the MIT License (see LICENSE.MIT).

sh-manpage-completions's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.