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

Explicitly state build_options in help output, fixes #363 #364

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/shards.1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Requires the presence of a \fIshard.yml\fR file. See \fBshard.yml\fR(5) for
more information on its format.
.SH COMMANDS
.PP
\fBbuild\fR [\fI<targets>\fR] [\fI<options>\fR...]
\fBbuild\fR [\fI<targets>\fR] [\fI<build_options>\fR...]
.RS 4
Builds the specified \fItargets\fR in \fBbin\fR path. If no targets are specified, all are built.
This command ensures all dependencies are installed, so it is not necessary to run \fBshards install\fR before.
Expand Down
27 changes: 15 additions & 12 deletions src/cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ module Shards
shards [<options>...] [<command>]

Commands:
build [<targets>] [<options>] - Build the specified <targets> in `bin` path.
check - Verify all dependencies are installed.
init - Initialize a `shard.yml` file.
install - Install dependencies, creating or using the `shard.lock` file.
list [--tree] - List installed dependencies.
lock [--update] [<shards>] - Lock dependencies in `shard.lock` but doesn't install them.
outdated [--pre] - List dependencies that are outdated.
prune - Remove unused dependencies from `lib` folder.
update [<shards>] - Update dependencies and `shard.lock`.
version [<path>] - Print the current version of the shard.

Options:
build [<targets>] [<build_options>] - Build the specified <targets> in `bin` path.
check - Verify all dependencies are installed.
init - Initialize a `shard.yml` file.
install - Install dependencies, creating or using the `shard.lock` file.
list [--tree] - List installed dependencies.
lock [--update] [<shards>] - Lock dependencies in `shard.lock` but doesn't install them.
outdated [--pre] - List dependencies that are outdated.
prune - Remove unused dependencies from `lib` folder.
update [<shards>] - Update dependencies and `shard.lock`.
version [<path>] - Print the current version of the shard.

Build options:
Use "crystal build --help" to see available build options.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be mentioned here. There are no explanations for other command's arguments either.
That would better fit for a more detailled shards build --help if that was a thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since shards build --help is not a thing, I'm assuming we have to somehow clarify that build_options have nothing to do with GENERAL OPTIONS, same way it's stated in the manpage.

I also don't see a way how we could implement shards build --help without copying the info from crystal build --help directly and then somehow keeping these two in sync.

Any ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well shards build --help wouldn't list the options explicitly but show more details information about the command itself, just like the build entry on the manpage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we can specify it in the build arg itself, does this seem suitable?

build [<targets>] [<build_options>]  - Build the specified <targets> in `bin` path, all build_options are delegated to `crystal build`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RX14! I've updated the code accordingly.


General options:
HELP
puts opts
exit
Expand Down