carapace-sh / carapace-spec Goto Github PK
View Code? Open in Web Editor NEWdefine simple completions using a spec file
Home Page: https://carapace.sh
License: MIT License
define simple completions using a spec file
Home Page: https://carapace.sh
License: MIT License
Add Action.Unless
modifier with conditions.
$(<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
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
Rename macros using CamelCase for consistency.
Support macros for values returned from $()
.
Exclude execute macros like $()
from this for security reasons.
e.g. $files().chdir(/tmp).multiparts(/)
use reflection to not enforce rsteube/carapace-pflag
Support exposed macros
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>
).~/.config/carapace/macros/custom.yaml
)/usr/share/carapace/macros/system.yaml
)related #218
Lots of frameworks and languages have json support out-of-the box but yaml would introduce an additional dependency.
Provide secondary support for json (import/conversions).
No response
Maybe support default values for optarg flags. At least for scraping it might be useful.
flags:
-o, --optarg[defaultValue]?: optarg flag
No response
Provide special substitution to $C_FLAGS
by expanding it to all currently set flags.
Use shlex.Join for formatting.
No response
executed too late?
Parse spec and generato a go based completer similar to carascrape
return ActionMessage
for any error
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.
support ActionMultiParts.
string array macro with delimiter as first element
$multiparts([:, $_os.Users, $_os.Groups])
No response
Add hiddenFlags
for flags that are hidded but can still be completed.
Also to prevent parse errors when using them.
No response
No response
Maybe support nargs for flags. Completion would be an issue though.
flags:
-n, --nargs{2}=: flag with 2 arguments
completion:
flag:
nargs{0}: ["1", "one"]
nargs{1}: ["2", "two"]
related #176
support carapace-sh/carapace#599
Remove the _
prefix from core macros and use it for custom defined macros.
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
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.
No response
No response
Add run
documentation including aliases.
No response
No response
pwsh -c "Invoke-Command {param($p1); echo a b $p1} -ArgumentList 11,22"
related PowerShell/PowerShell#13832
name: example
aliases: [e, demo]
description: example description
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!!!
Pass all positional arguments to shell macro so that they can be accessed with $@
, $1
...
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
Optionally passing flags possible as well? (raw mode)
related #270
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.