complete
complete copied to clipboard
Install without using Flags
I would prefer to use a completely different approach to exposing the install/uninstall than with the flags
package. I'm using a completely different package for building CLI apps, and would like to integrate the output of this framework with that other package by simply Printing/Sprinting the output to wherever the user wants.
Hi!
Do you mean the COMP_INSTALL
and COMP_UNINSTALL
environment variables?
The Install/Uninstall functions can also be called manually. Look at this file: https://github.com/posener/complete/blob/master/install/install.go
Does this help or I totally missed your request?
Do you mean the
COMP_INSTALL
andCOMP_UNINSTALL
environment variables?
I must've missed where these were documented. Is this an end-user solution?
The Install/Uninstall functions can also be called manually. Look at this file: https://github.com/posener/complete/blob/master/install/install.go
I'll take a look. Thank you.
I'm also realizing that I was using v1, but this functionality appears to be in v2. But when I try to include v2, I'm getting errors. Ideas?
.PHONY: build
build:
mkdir -p ./bin
cd ./src/ && go mod tidy
go get -v ./src/...
go build -ldflags="-s -w" -o bin/mkit src/*.go
mkdir -p ./bin
cd ./src/ && go mod tidy
go: finding module for package github.com/posener/complete/v2
go: downloading github.com/posener/complete v1.2.3
go: found github.com/posener/complete/v2 in github.com/posener/complete/v2 v2.0.1-alpha.12
go get -v ./src/...
github.com/posener/complete (download)
package github.com/posener/complete/v2: cannot find package "github.com/posener/complete/v2" in any of:
/usr/local/go/src/github.com/posener/complete/v2 (from $GOROOT)
/go/src/github.com/posener/complete/v2 (from $GOPATH)
make: *** [Makefile:42: build] Error 1
My go.mod
file references github.com/posener/complete/v2 v2.0.1-alpha.12
.
Also, my request is more to expose bash.cmd()
(and the others) as bash.Cmd()
so that I can access it directly and get its contents. I don't keep this stuff in my own ~/.bash_profile
, and I would like to have more control over how the autocompletion script gets loaded.
I must've missed where these were documented. Is this an end-user solution?
Right, I missed documenting them, added. Yes, this is an end-user solution.
I'm also realizing that I was using v1, but this functionality appears to be in v2. But when I try to include v2
Yes, you should use v2, it is written in the documentation of v1.
I'm getting errors. Ideas?
It is hard to help you. It would be easier if you could reference repo, or drop here files that you use for your project. It should be possible to use v2 when you import github.com/posener/complete/v2
.
Also, my request is more to expose bash.cmd() (and the others) as bash.Cmd() so that I can access it directly and get its contents. I don't keep this stuff in my own ~/.bash_profile, and I would like to have more control over how the autocompletion script gets loaded.
Can you be more concrete about the API change that you want? Do you want to be able to provide a custom file? Or just the line that is needed to be added to the profile script?
Can you be more concrete about the API change that you want? Do you want to be able to provide a custom file? Or just the line that is needed to be added to the profile script?
Just the line that is needed to be added to the profile script.