Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

phuctm97/shell.how

Open more actions menu

Repository files navigation

Explain shell commands using next-generation autocomplete from Fig.

shell.how - Explain how your shell command works | Product Hunt

Contributing

Requirements

  • Node 14

  • Yarn 1.22+

Setup

  1. Install requirements

  2. Clone the repository

  3. Run yarn to install dependencies

Develop

Tech stack

  • TypeScript

  • Next.js

  • Tailwind CSS

  • Recoil for state management, it works natively with React concurrent mode & has builtin caching, allows lean pattern for querying dynamic data (see hooks/use-spec.ts)

  • React concurrent mode for loading data before rendering components & handling errors

Start development

  • Run yarn start to start development

  • Commit adhering to Angular commit convention, use yarn commit or Code conventional commits to commit interactively

  • Submit a PR and make sure required status checks pass

  • When a PR is merged or code is pushed to main:

    • Vercel deploys latest changes to shell.how

    • Github validates and creates a new release if there're relevant changes

Understand parser

The parser has 2 steps:

  1. Escape and split the string into tokens delimited white space, a quoted string is a single token. Nested quotes are supported, too.

  2. Load Fig's autocomplete spec for the command (the first token from step 1). Iterate through the tokens, validate, and annotate the tokens with information from the spec.

interface Token extends SimpleToken, Fig.BaseSuggestion {
  indices: [number, number]; // [start, end], end is exclusive
  value: string; // a copy of [start, end) from original string
  type: "command" | "subcommand" | "option" | "argument";
}

Author

Minh-Phuc Tran (@phuctm97) - Fig

About

Explain shell commands using next-generation autocomplete Fig.

Topics

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.