-
Notifications
You must be signed in to change notification settings - Fork 132
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
Switch to optparse #980
Switch to optparse #980
Conversation
spaghetto/bin/src/Main.purs
Outdated
|
||
-- <* hsubparser (help "") | ||
-- <* infoOption BuildInfo.currentSpagoVersion (?_) | ||
-- ArgParser.flagInfo [ "--version" ] "Show the current version" BuildInfo.currentSpagoVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need a spago --version
flag to return the current version number, which is what the BuildInfo.currentSpagoVersion
returns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to use a command instead of a flag for printing the version.
This command doesn't trigger printing the help message when prefShowHelpOnError
is set to true
.
I considered infoOption
, but this option always fails. So, it prints both a version and a help message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need a flag for the version, rather than a command - this has come up before, see #608
I'd basically like to mirror the behaviour of purs
:
$ purs --version
0.15.9
..so it would we great if we can avoid printing the help message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a --version
flag. After spago bundle -p spago-bin
:
$ bin/bundle.js --help
Usage: bundle.js ([COMMAND] | [-v|--version])
PureScript package manager and build tool
Available options:
-h,--help Show this help text
-v,--version Show the current version
Available commands:
init Initialise a new project
...
$ bin/bundle.js --version
0.93.9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the version
command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a --version flag
Looks great!
Should I remove the version command?
Yes please! We shouldn't add one unless it's necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 87ccdf6
e4ff54c
to
bf02067
Compare
@f-f, please, review |
@deemp I was on holiday and mostly offline, will have a look now |
I'm sorting out CI so that we can merge - we still have the Haskell CI, so the tests for the new spago are not running at all yet |
We have PureScript CI now! Could you rebase on the latest commit? I had to shuffle files around unfortunately, so it might be easier to just copy the patch to a new branch instead of trying to merge. |
@deemp did you get any chance to look at this? anything I could help with? |
@f-f, rebased and built 👌 |
@f-f, why does the spago/.github/workflows/build.yml Line 76 in 5300c57
UPD: lol, it shouldn't work with the top-level command |
It's a good thing this fails explicitly now 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for rebasing @deemp! This looks great now - I left a few comments, mostly for things that slipped in the merge, but it's otherwise good to go
Ah, CI doesn't seem to be happy - we got a few of nonexistent options being used in the test (which should be easy to fix), but the bulk of the issue is - I think at least - the fact that we are using records to collect flags and arguments: this was ok when using |
Co-authored-by: Fabrizio Ferrai <fabrizio.ferrai@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a few tests failing - @deemp you can run tests locally with spago test
to iterate more quickly (get the latest spago with npm install -g spago@next
)
@deemp amazing - feel free to comment out the remaining failing test, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, this is finally green - merging.
Thanks a lot @deemp for the patch! 👏
@f-f, thanks for your guidance! |
@f-f, this PR addresses #977
Description of the change
I used optparse instead of argparse for building
spaghetto
CLI.optparse
supports completions forbash
,zsh
,fish
.My tools were purescript
0.15.10
and spago0.93.9
.I followed the Developing instructions and built an executable in the
spaghetto
directory.Next, I manually tested completions
Finally, I ran tests with
spago test
11/13 tests were successful.
Warning
ARGS
in some places. They can be renamed/removed when necessary