GithubHelp home page GithubHelp logo

carapace-sh / carapace-spec Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 1.0 1.92 MB

define simple completions using a spec file

Home Page: https://carapace.sh

License: MIT License

Go 100.00%
bash completion elvish fish ion nushell oil powershell tcsh xonsh

carapace-spec's People

Contributors

dependabot[bot] avatar rsteube avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

sarvex

carapace-spec's Issues

windows support

$(<COMMAND>) is executed in a sh shell and should be skipped on windows.
Add $win(<COMMAND>) or similar for that provides a variant working on windows using powershell.

related #14

user defined macros

load user defined macros from $(UserConfigDir)/carapace/macros

name: refs
description: git refs
default:
  branches: false
  tags: false
completion:
  - "$(${C_ARG_BRANCHES:-false} && git branch | cut -c 3-)"
  - "$(${C_ARG_TAGS:-false} && git tag)"

related #17
related #carapace-sh/carapace-bin#1082

support exposed macros

Request

Support exposed macros

Proposed solution

  • macro core macro.
  • _.macro (or _macro as it is now) internal macro of command interpreting the spec.
  • command.macro external macro (<command> _carapace macro <macro>).
  • TODO user defined macros (~/.config/carapace/macros/custom.yaml)
  • TODO system macros (/usr/share/carapace/macros/system.yaml)

Anything else?

related #218

json support

Request

Lots of frameworks and languages have json support out-of-the box but yaml would introduce an additional dependency.

Proposed solution

Provide secondary support for json (import/conversions).

Anything else?

No response

support default values for optargs

Request

Maybe support default values for optarg flags. At least for scraping it might be useful.

Proposed solution

flags:
  -o, --optarg[defaultValue]?: optarg flag

Anything else?

No response

How to pass variables to command?

Is there a way to pass positional arguments to a command? something like ['$(cmd1 $C_ARG0 $C_ARG1 $C_ARG2)']

So that I can use an external command to do the dynamic completion.

multiparts support

Request

support ActionMultiParts.

Proposed solution

string array macro with delimiter as first element

$multiparts([:, $_os.Users, $_os.Groups])

Anything else?

No response

hidden flags support

Request

Add hiddenFlags for flags that are hidded but can still be completed.
Also to prevent parse errors when using them.

Proposed solution

No response

Anything else?

No response

suport nargs

Request

Maybe support nargs for flags. Completion would be an issue though.

Proposed solution

flags:
  -n, --nargs{2}=: flag with 2 arguments
completion:
  flag:
    nargs{0}: ["1", "one"]
    nargs{1}: ["2", "two"]

Anything else?

related #176

custom macros

Remove the _ prefix from core macros and use it for custom defined macros.

plugin support

Add plugins bool (intended for root command) to enable implicit embedding of [spec.name]-plugin completion (e.g. cargo-fmt, git-extras).

name: example
plugins: true

rename `name` and `description`

Request

Consider renaming name to use and description to short.
Initially this felt more intuitive but since name now supports the full usage it might be a good idea to align the terms to cobra command.
Both could be supported for a while for transition.

Proposed solution

No response

Anything else?

No response

doc: add run

Request

Add run documentation including aliases.

Proposed solution

No response

Anything else?

No response

support aliases

name: example
aliases: [e, demo]
description: example description

Think about a translator for fig.io completions?

There is some company trying to monetise completions for teams (thus they have more resources etc.), and their tool uses spec files for completions (MIT licensed I think) written in typescript:

https://fig.io/docs/getting-started

Potentially, making use of these may ease the burden on you to keep spec files up-to-date, but would require a translator from their files to your yaml ones. By the way thanks a ton for this, it really makes it easier for end-users to tweak completions!!!

Macro: pass all arguments

Request

Pass all positional arguments to shell macro so that they can be accessed with $@, $1 ...

Proposed solution

esh โฏ bash -c "echo one" -- two three
one
carapace-spec on ๎‚  master [!] via ๐Ÿน v1.22.0                                                                                             
esh โฏ bash -c "echo one $1" -- two three
one two
carapace-spec on ๎‚  master [!] via ๐Ÿน v1.22.0                                                                                             
esh โฏ bash -c "echo one $@" -- two three
one two three

Anything else?

Optionally passing flags possible as well? (raw mode)

related #270

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.