8000 Kingpin get stuck if "@" is found in the command line · Issue #185 · alecthomas/kingpin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Kingpin get stuck if "@" is found in the command line #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kaoet opened this issue Apr 14, 2017 · 2 comments
Closed

Kingpin get stuck if "@" is found in the command line #185

kaoet opened this issue Apr 14, 2017 · 2 comments

Comments

@kaoet
Copy link
kaoet commented Apr 14, 2017

My code (The official example):

package main

import (
        "fmt"
        "gopkg.in/alecthomas/kingpin.v2"
)

var (
        verbose = kingpin.Flag("verbose", "Verbose mode.").Short('v').Bool()
        name    = kingpin.Arg("name", "Name of user.").Required().String()
)

func main() {
        kingpin.Parse()
        fmt.Printf("%v, %s\n", *verbose, *name)
}

My command: go run test.go @

What happens? Nothing! The program just get stuck, without any output.

What's expected? The library reports invalid syntax in command line.

@alecthomas
Copy link
Owner

This is a bug that has already been fixed, but I'd forgotten to push to a new release. I've just tagged v2.2.4, so pull down the latest version and try again.

@falzm
Copy link
falzm commented Dec 17, 2017

Bug is still present in latest version (v2.2.5, tip of branch master)...

alecthomas added a commit that referenced this issue Dec 17, 2017
gzdunek pushed a commit to gravitational/kingpin that referenced this issue May 10, 2023
Really fixes alecthomas#185.

(cherry picked from commit 947dcec)
gzdunek added a commit to gravitational/kingpin that referenced this issue May 11, 2023
* Fix bug where --help doesn't terminate.

(cherry picked from commit e590021)

* Fix envars with numbers.

Fixes alecthomas#138.

(cherry picked from commit e9044be)

* Set the correct member when ErrorWriter is called

(cherry picked from commit 65238cf)

* Update doc.go

Fixes alecthomas#142

(cherry picked from commit d2d8a91)

* Parse short argument as rune not as byte to support unicode characters

(cherry picked from commit ea545af)

* Fix misspelling

(cherry picked from commit be339f4)

* Simplify error checking logic

(cherry picked from commit dfe71e7)

* Changing from snake case to camel case

(cherry picked from commit 22a5799)

* Fixed HTTPHeader example.

(cherry picked from commit e64c31b)

* Add test for map reset when created.

(cherry picked from commit a9cc9f3)

* fixing file param as last argument alecthomas#148

(cherry picked from commit 8071e65)

* Link to gitter

(cherry picked from commit ce24859)

* Update README.md

(cherry picked from commit 4632cad)

* Make URLList a cumulative type

(cherry picked from commit fc9d793)

* Add link to parsers.go in README.md

This makes clear that the parsers aforementioned are not the only ones included with kingpin, and are only examples.

(cherry picked from commit 0286242)

* Added newline to example in README

(cherry picked from commit 7f0871f)

* Fix bug when mixing @file with other args or flags

(cherry picked from commit 620a22e)

* trivial: gofmt ./...

(cherry picked from commit 5a61528)

* Fix README HintAction function signature

(cherry picked from commit fc56a01)

* Generated .String() functions now return the correct value.

Fixes alecthomas#201.

(cherry picked from commit 1087e65)

* Switch to testify/assert.

(cherry picked from commit 1d8c623)

* Fix README simple example count.

(cherry picked from commit 2d359b5)

* Import from gopkg like the other examples

This was the only example not importing from gopkg. When trying multiple examples this one would not work because it was not available locally. It took me a while to understand what was happening.

(cherry picked from commit 297a08e)

* README: Correct case of Flag() function

(cherry picked from commit fde80b5)

* Fix setDefaults to exit early on `--help`

When `--help` is passed, there is no need to set and validate default
flags/arguments, since we are just going to print the usage text and
exit.

This fixes alecthomas#218.

(cherry picked from commit 7e2d128)

* Fix error propagation from @ failures.

Really fixes alecthomas#185.

(cherry picked from commit 947dcec)

* Skip empty lines with @

Fixes alecthomas#210.

(cherry picked from commit 80e348d)

* Do not display additional-flags token in usage when all flags are required

(cherry picked from commit d1e5344)

* Do not generally hide help and completion flags

(cherry picked from commit 304264a)

* define map globally

(cherry picked from commit 2a5eb22)

* Add ability to disable file expansion globally

(cherry picked from commit a395891)

* Improve the shell completion templates

* Complete file names when there are no matches.
* Convert to a native Zsh completion script .
* Don't call compinit. That is up to the user. Calling it resets the
completion system.
* Quote array expansion with '@' to avoid dropping empty entries.
* The Zsh completion script can both be eval-ed and installed into
fpath.

(cherry picked from commit c2ca6a1)

* all: convert to a Go module

Using the latest current versions of the template and units packages.
Test dependencies are included too.

Fixes alecthomas#253.

(cherry picked from commit 102f372)

* Bump Go versions and use '.x' to always get latest patch versions

(cherry picked from commit 81f0b44)

* Add file expanding example

(cherry picked from commit e7f8ee3)

* Fix module import.

(cherry picked from commit 7613e5d)

* delete duplicate blank in doc

Signed-off-by: Xiang Dai <764524258@qq.com>
(cherry picked from commit b65126d)

* Complete the last argument if not matching a hint

Instead of stopping the completion when there is a value for an
argument, try to verify if the value is matching one of the valid
option. If it's not matching, try to suggest all options starting by the
entered value.

(cherry picked from commit 42d1504)

---------

Co-authored-by: Alec Thomas <alec@swapoff.org>
Co-authored-by: Nicholas Parker <nick@nickbp.com>
Co-authored-by: Henri Koski <henri.koski@codemate.com>
Co-authored-by: Ben Gadbois <enharmonicdistortion@gmail.com>
Co-authored-by: Sven <sven@lindow-software.de>
Co-authored-by: Lorenz Bauer <lmb@cloudflare.com>
Co-authored-by: Antoine Bolvy <antoine.bolvy@gmail.com>
Co-authored-by: Nathan Bullock <nathanbullock@gmail.com>
Co-authored-by: Eric Klaus <eric.klaus@workiva.com>
Co-authored-by: David Cheney <dcheney@atlassian.com>
Co-authored-by: Pieter Slabbert <zan.xhipe@gmail.com>
Co-authored-by: Carlos Oliveira <carlos.baptista@b2wdigital.com>
Co-authored-by: PotHix <pothix@pothix.com>
Co-authored-by: Saj Goonatilleke <sg@redu.cx>
Co-authored-by: Andrew Mason <andrew@fixedpoint.xyz>
Co-authored-by: danielb42 <daniel@masterunit.net>
Co-authored-by: Aaron Boodman <aaron@aaronboodman.com>
Co-authored-by: Segev Finer <segev208@gmail.com>
Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
Co-authored-by: Harald Nordgren <haraldnordgren@gmail.com>
Co-authored-by: Omer Levi Hevroni <omerlh@users.noreply.github.com>
Co-authored-by: Xiang Dai <764524258@qq.com>
Co-authored-by: Emilien Kenler <emilien@kkvesper.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0