8000 Using --graceful instead of -graceful since single hyphen is treaded as short version of a flag · Issue #5604 · beego/beego · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

Using --graceful instead of -graceful since single hyphen is treaded as short version of a flag #5604

Closed
bo-er opened this issue Feb 28, 2024 · 3 comments · Fixed by #5633
Closed

Comments

@bo-er
Copy link
Contributor
bo-er commented Feb 28, 2024
  1. What version of Go and beego are you using (bee version)?
    the latest

  2. What operating system and processor architecture are you using (go env)?
    irrelevent to the problem

  3. What did you do?
    I have a project that is using both cobra and beego, when beego's graceful restart functionality is enabled, cobra treats "- graceful" as "-g" + "raceful"

  4. What did you expect to see?
    beego should restart the program using "--graceful" instead of "-graceful"

  5. What did you see instead?
    cobra now treats -graceful as "-g" + "raceful", and will return an error.

  6. Why
    The single hyphen is used with "short" argument like this:
    ./bin/abc -h
    While the double hyphen is used with "long" argument like this:
    ./bin/abc --help

IMHO, we should follow the common wisdom and make a small change:
image

@bo-er
Copy link
Contributor Author
bo-er commented Feb 29, 2024

right now, I have to do a workaround like this:

for i, arg := range os.Args {
		if arg == "-graceful" {
			nos.Args[i] = "--graceful"
		}
	}

@flycash
Copy link
Collaborator
flycash commented Apr 6, 2024

good suggestion, can you help to raise a merge request?

@bo-er
Copy link
Contributor Author
bo-er commented Apr 7, 2024

good suggestion, can you help to raise a merge request?

Hi flycash, here is the merge request: #5633

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

Successfully merging a pull request may close this issue.

2 participants
0