carapace-sh / carapace-bin Goto Github PK
View Code? Open in Web Editor NEWmulti-shell multi-command argument completer
Home Page: https://carapace.sh
License: MIT License
multi-shell multi-command argument completer
Home Page: https://carapace.sh
License: MIT License
use go:generate to create cmd/completers.go
and completers/*/main.go
carapace
seen at git log .
in elvish
needs some tests as some completions are probably not correct
update readme with new asciicast that does not use docker-compose
to suppress default complete
command
simpler to install additional commands to test and has newer versions
related carapace-sh/carapace#58
chown --from games:<TAB>
(eval):1: parse error near `$(carapace chown zsh...'
_arguments:453: command not found: eval $(carapace chown zsh '_chown##from' hown --from games
add some command similar to caraparse to scrape go commands (like kubectl)
crude code used to prepare kubetl for caraparse parsing:
func scrape(cmd *cobra.Command) {
if cmd.Hidden {
return
}
text := make([]string, 0)
text = append(text, fmt.Sprint(uid.Command(cmd)))
text = append(text, fmt.Sprint(cmd.Name()))
text = append(text, fmt.Sprint(cmd.Short))
cmd.LocalFlags().VisitAll(func(f *pflag.Flag) {
val := ""
if f.Value.Type() != "bool" {
val = "VAL"
}
usage := strings.Split(f.Usage, "\n")[0]
if len(usage) > 100 {
usage = usage[:100]
}
if f.Shorthand == "" {
text = append(text, fmt.Sprintf("--%v %v %v", f.Name, val, usage))
} else {
text = append(text, fmt.Sprintf("-%v, --%v %v %v", f.Shorthand, f.Name, val, usage))
}
})
_ = ioutil.WriteFile("out/" + uid.Command(cmd) + ".txt", []byte(strings.Join(text, "\n")), 0644)
for _, subcmd := range cmd.Commands() {
scrape(subcmd)
}
}
related aws/aws-cli#6344
init()
function calls can now be logged so add a ci test to not let the startup time get out of hand
GODEBUG=inittrace=1 go run . 2>&1 | grep 'init github.com/rsteube/carapace-bin/comp
leters' | awk '{print $5" "$6" "$2}' | sort -r
# 5.9 ms github.com/rsteube/carapace-bin/completers/kubectl_completer/cmd
# 2.6 ms github.com/rsteube/carapace-bin/completers/git_completer/cmd
# 2.4 ms github.com/rsteube/carapace-bin/completers/docker_completer/cmd
# 1.0 ms github.com/rsteube/carapace-bin/completers/cargo_completer/cmd
# 0.55 ms github.com/rsteube/carapace-bin/completers/vlc_completer/cmd
# 0.53 ms github.com/rsteube/carapace-bin/completers/tar_completer/cmd
# 0.43 ms github.com/rsteube/carapace-bin/completers/adb_completer/cmd
# 0.39 ms github.com/rsteube/carapace-bin/completers/nmcli_completer/cmd
related #136
completions need to be invoked once before they can be replaced so that they are not autoloaded:
complete --do-complete 'chown ' > /dev/null
complete --erase -c 'chown'
complete -c 'chown' -f -a '(_carapace_lazy chown)'
needs: fish-shell/fish-shell#6716
add missing completions to rg
(ripgrep)
related carapace-sh/carapace#76
aliases need to be read from cmd
with increasing amount of completers might need to use yaegi to only initialize the needed command (assuming all init methods are called on invokation - need to check this)
https://docs.npmjs.com/cli/v7/commands
test and fix completion
Management Commands:
Commands:
e.g.
/actions/git/git.go
fixes carapace-sh/carapace#64
add jobs to source completions for each shell
git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
https://git-scm.com/book/en/v2
XL
No response
Main Porcelain Commands
Ancillary Commands / Manipulators
Ancillary Commands / Interrogators
Interacting with Others
Low-level Commands / Manipulators
Low-level Commands / Interrogators
Low-level Commands / Syncing Repositories
Low-level Commands / Internal Helpers
External commands
migrate fork (https://github.com/rsteube/glab) to standalone completer
needs elves/elvish#1153
background service where carapace runs in background and provides completion over socket communication.
will set CARAPACE_SOCKET=/somefile
environment variable and if this exists (assume a server is running) generate the lazy loaded completion scripts with callback snippet that invokes nc
instead of the carapace binary.
This should improve performance.
First of all let me say I am totally amazed by carapace. I discovered it thanks to your PR cli/cli#2728 and was blown away when I discovered what it can do.
One minor thing I'd like to ask/request is how to change the format used for the descriptions?
In my ZSH setup using the standard completion source (e.g. for gh) the descriptions are separated by --
, which I like.
After loading carapace (source <(carapace gh zsh)
) the descriptions change to this format (using parentheses)
If possible I'd like to keep my existing description format so that it stays uniform across different commands.
Here's my zshrc for reference: https://github.com/disrupted/dotfiles/blob/4957c485b2b7bf2a73af9393bf8d599fd6afbfec/.zshrc
add completions
test and fix errors
pub
pub
Basic Commands (Beginner):
create Create a resource from a file or from stdin.
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
run Run a particular image on the cluster
set Set specific features on objects
Basic Commands (Intermediate):
Deploy Commands:
Cluster Management Commands:
Troubleshooting and Debugging Commands:
Advanced Commands:
Settings Commands:
Other Commands:
with go fmt
check
since shorthand-only flags are now possible the existing completions must be updated
output and upload sarif reports for pr code comments
see https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
see https://github.com/owenrumney/go-sarif
finalize ssh completer
add flag and positional completion
common commands
installed commands:
https://medium.com/@lightcone/how-to-profile-go-programs-c6c00e8f2ebf
https://flaviocopes.com/golang-profiling/
use an environment variable (e.g. CARAPACE_PROFILEDIR
) so that multiple can be creating during actual use
related #136
work on different folders
see https://rsteube.github.io/carapace/carapace/action/chDir.html
add completions
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.