Comments (5)
Yeah, it would be great to support something like this. For this to be really useful, there are still some things missing.
- A way to indicate that a flag argument is a file, could be a
type Filename string
alias - A way to complete positional arguments in a certain way (for example as files).
from go-flags.
- In my way, a simple predefined
Filename
withFlagComplete
function will do. - What we could do (if we neglect issue #33 , which allows one to add completion in exactly the same way). Is to add
FlagCompletePositional()
method to the flag's struct itself.
type opt struct {
verbose `short:"v"`
}
func (o *opt) FlagCompletePoistional(args []string) []string {
if len(args) == 0 {
return []string{"first1", "first2"}
}
return []string{"rest1", "rest2"}
}
from go-flags.
I would feel more inclined to then also fix #33. Additionally, the FlagComplete should accept a string and complete towards partial matches of that string, instead of just all matches. I would also only match flags (--verbose) if there is an initial -, which I think is more in line with how bash completion is normally implemented.
from go-flags.
I've finally gotten around to implementing this. Please see the docs for information on how it works and how you can enable bash-completion for your application.
from go-flags.
Awesome, thanks for this. Looking forward to using it.
from go-flags.
Related Issues (20)
- Add a working completion example for 'zsh' shell
- Add a man generator for markup (ronn-style)
- Need proper documentation on how to correctly handle errors HOT 13
- Can flags be used to parse command line arguments from 'go test' ? HOT 2
- Is this an abandoned project?
- Is this an abandoned project? HOT 21
- Program description
- A little leverage
- help format default posix in windows, I don't want to use -tags=forceposix, let them use -tags=forcewindows HOT 2
- Fix CVE-2022-29526 vulnerability caused by golang.org/x/sys? HOT 2
- How to group subcommands HOT 3
- Is it possible to have dynamically generated help descriptions?
- Passing options as argument to other options without using positional-args HOT 1
- custom type positional argument ValueValidator implementation is ignored
- How do I add a flag and pass the value there?
- Multiple short options are not detected with `IgnoreUnknown` flag.
- Support unicode chars in WriteHelp
- Manage unset flag/environment variable HOT 3
- group.go mixed left quote (`) with single quote (') HOT 1
- Is this the best (or only) way to figure out which subcommands have been used? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-flags.