GithubHelp home page GithubHelp logo

yamaton / h2o-curated-data Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 0.0 38.85 MB

Semi-hand curated command-line option data for many CLI programs, geared toward bioinformatics tools. Shell completion scripts are also available.

Shell 69.90% Python 20.59% Makefile 9.51%
dataset cli vscode-extension shell bash zsh fish bioinformatics

h2o-curated-data's Introduction

CLI curated data for shell completion

This repository contains command-line specs for Shell Completion for VS Code. This repository also contains tab completion scripts for bash/zsh/fish shells.

Shell completion scripts for bioinformatics tools are located in the separate repositories:

Loading the data in VS Code

  • In VS Code, type Ctrl+Shift+P (or โŒ˜+โ‡ง+P on macOS) and run following commands:
    • Shell Completion: Load Common CLI Data to load commands in general.txt
    • Shell Completion: Load Bioinformatics CLI Data to load commands in bio.txt

Shell completion for bash/zsh/fish

They would be useful especially for bioinformaticians.

bash

Copy files (general) to ~/.bash_completion.d/, and add the following to ~/.bashrc.

for bcfile in ~/.bash_completion.d/* ; do
    . "$bcfile"
done

zsh

Save files (bio, general) to ~/.zfunc, then add the following line to ~/.zshrc.

fpath=( ~/.zfunc "${fpath[@]}" )

fish

Save files (bio, general) to ~/.config/fish/completions/.

How I prepare the data

I use h2o (closed source code) to extract CLI specs, and then apply yq to convert from JSON to YAML.

Here is how I extracted the CLI info from medaka, for example.

# Just see how it works
$ h2o --command medaka

# ...OK. H2o seems to fail parsing some.
# So save the help document as text file for manual editing...
$ medaka --help > medaka.txt

# Edit medaka.txt s.t. command options, subcommands, and descriptions are placed nicely.
# ...
# ...
# After finishing the edit, extract the data as YAML file.
$ h2o --file medaka.txt --format json | yq eval -P > bio/yaml/medaka.yaml

# Add TLDR to the YAML, then convert it to JSON and bash/zsh/fish scripts
# group=bio sets the environment variable and run make
# The makefile calls multiple scripts including
#    - Add TLDR to YAML
#    - Convert YAML to JSON
#    - Create bash/zsh/fish scripts
#    - Take the entire JSON as an array, create a gzipped JSON file
$ group=bio make

Data structure

Here is a sample file.

name: tar
description: an archiving utility
options:
  - names:
      - -x
      - --extract
      - --get
    argument: ""
    description: extract files from an archive
  - names:
      - -v
      - --verbose
    argument: ""
    description: verbosely list files processed
version: tar (GNU tar) 1.34

As you can see, an entry has following key-values:

  • name (string)
  • description (string)
  • options (list)
    • names (list of strings)
    • argument (string)
    • description (string)
  • [optional] positionalArguments
    • name (string)
    • description (string)
  • [optional] subcommands:
    • (Here comes a list of the entire structure. Nested.)
  • [optional] inheritedOptions (same type as options)
  • [optional] usage (string)
  • [optional] version (string)
  • [optional] tldr (string)

h2o-curated-data's People

Contributors

yamaton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

h2o-curated-data's Issues

Extra hyphens at re-add argument

Hi,

if you are using the completion function and select an element from the offered list, it inserts fine, but for instance, you delete the part of the inserted argument and you want to add it again by CTRL+SPACE the list appears again, and when you want to add it again it will insert extra hyphens.

Code_1gh8FcNgZG

I experienced the same issue with other commands as well.

Unhandled error at Load Command

Hi,

when I wanted to load a new command and asked the command name, I clicked anywhere outside the input field.
Even the editor or out of VSCode I got the following error message.

Code_OftK5RwuKP

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.