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

cli argument flag processing disregarding flag values #16

Closed
vladdoster opened this issue Dec 7, 2021 · 4 comments
Closed

cli argument flag processing disregarding flag values #16

vladdoster opened this issue Dec 7, 2021 · 4 comments

Comments

@vladdoster
Copy link

Can't grok logic for the returns asset choices

command in question

$ eget --asset=.tar.gz --system=linux/amd64 neovim/neovim

4 candidates found for asset .tar.gz
please select manually:
  (1) nvim-linux64.tar.gz
  (2) nvim-linux64.tar.gz.sha256sum
  (3) nvim-macos.tar.gz
  (4) nvim-macos.tar.gz.sha256sum
Enter selection number:

The above command and subsequently returned choices strikes me to believe that:

  1. This is a bug in the processing of CLI flags that disregards previous flag
    values and returns results that should have been filtered out.

ex. I specify criteria of .tar.gz assets for Linux, but eget returned
darwin assets that don't satisfy criteria.

Happy to fix this, but wanted to get confirmation before doing needful.

  1. Somewhat quirky behavior which I am guilty of glossing over when reading
    through documentation. If this is the case, could you ELI5 the design choices
    around parsing CLI arguments and another hypothetical scenario that explains
    returned asset choices?
@vladdoster
Copy link
Author

@zyedidia Any input on this?

@zyedidia
Copy link
Owner

Currently the asset and system flags do not filter each other, instead the asset option has priority. I will consider ways that this can be fixed.

@vladdoster
Copy link
Author

@zyedidia

You could do something simple like...

package main

import (
	"fmt"
	"strings"
)

func main() {
        # uses --system arg
	fmt.Println(strings.Contains("Assume", "sum"))
        # use --asset arg
	fmt.Println(strings.HasSuffix("Hello World", "World"))
}

However, the more straightforward solution would leverage regex.

@vladdoster
Copy link
Author

Thank you for the insight. Closing.

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

2 participants