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

Is there a way to support --switch=parameter syntax ?? #8

Open
rwilcox opened this issue Sep 12, 2021 · 4 comments
Open

Is there a way to support --switch=parameter syntax ?? #8

rwilcox opened this issue Sep 12, 2021 · 4 comments

Comments

@rwilcox
Copy link

rwilcox commented Sep 12, 2021

Given the following program --help generates help text that doesn't seem to support --parameter=text format, but --parameter text

#lang cli

(flag (file  in-file-path)
      ("-f" "--file" "filepath")
      (file in-file-path))

(program (hello)
  (displayln (file))
)

(run hello)

CLI output:

PS ... > D:\Racket\Racket.exe .\tmp.rkt --help
usage: hello [ <option> ... ]


<option> is one of


  -f <in-file-path>, --file <in-file-path>
     filepath to write the changelog to. Can NOTE use --file=foo must use --file foo
  --help, -h
     Show this help
  --
     Do not treat any remaining argument as a switch (at this level)

 *   Asterisks indicate options allowed multiple times.

 Multiple single-letter switches can be combined after
 one `-`. For example, `-h-` is the same as `-h --`.

PS ...> D:\Racket\Racket.exe .\tmp.rkt --file hello
hello
PS ...> D:\Racket\Racket.exe .\tmp.rkt --file=hello
hello: unknown switch: --file=hello
PS C:\Users\aias\Documents\Development\simple_changelog>

(but thank you very much for making this little language!)

@countvajhula
Copy link
Owner

Hi @rwilcox ! This package does not parse the command line syntax directly but instead simply leverages the command line arguments and flags reported by Racket's built-in current-command-line-arguments parameter. I did a quick google search to get a sense of how common the = syntax is, and I couldn't really say. At least one link mentioned it, but other links seemed to be unaware of it. Do you happen to know if it is considered a UNIX standard? If so, you may want to open an issue on the Racket repo directly to recognize this syntax in the core command line utilities. What do you think?

@rwilcox
Copy link
Author

rwilcox commented Sep 14, 2021

It’s in the libc docs, so I’m guessing it’s pretty common 😄

But OK, I may take a look at writing a command line program with the core utils, repro the issue and open a bug with Racket, that’s a good idea.

@countvajhula
Copy link
Owner

You can probably just use the example in the docs on the built-in command line utilities, which should be runnable as is. E.g. "link-flags" there takes an argument at the command line.

@rwilcox
Copy link
Author

rwilcox commented Dec 19, 2021

This has been on my radar for a while, but finally did something about it: racket/racket#4106

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