Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Improve help: change types to be more descriptive #51

Open
mikelik opened this issue Apr 27, 2023 · 5 comments
Open

Improve help: change types to be more descriptive #51

mikelik opened this issue Apr 27, 2023 · 5 comments

Comments

@mikelik
Copy link
Contributor

mikelik commented Apr 27, 2023

We may want to add type_name_fn() to options.

         subcommand->add_option("-p, path", path, "Path containing the project's yaml file.")
            ->type_name_fn([]()->std::string{ return "PATH"; });

to report as so:

Options:
  -h,--help                   Print this help message and exit
  -p PATH                   Path containing the project's yaml file.

On the other hand positionals would look bad, i.e. for init --help:

Positionals:
  path PATH REQUIRED          The root path to create the project in.
  project_name NAME REQUIRED  The name of the project.
  version VERSION [0.0.0]        The version to store in the project file.

Options:
  -h,--help                   Print this help message and exit
  -p PATH REQUIRED            The root path to create the project in.
  -n NAME REQUIRED            The name of the project.
  -v VERSION [0.0.0]             The version to store in the project file.

Originally posted by @ScottBailey in #50 (review)

@jolly-fellow
Copy link
Contributor

jolly-fellow commented Apr 27, 2023

IMHO if we will use only options the positionals will not look bad. :)

As I understand with ->type_name_fn([]()->std::string{ return "<PATH>"; });
it will looks like:

Options:
  -h,--help                   Print this help message and exit
  -p <PATH>                   Path containing the project's yaml file.

right?

@mikelik
Copy link
Contributor Author

mikelik commented Apr 27, 2023

If I add yours type_name_fn it will look like this:

$ ./antler-proj init --help
Initialize a new project creating the directory tree and a `project.yaml` file.
Usage: antler-proj init [OPTIONS] path project_name [version]

Positionals:
  path <PATH> REQUIRED        The root path to create the project in.
  project_name TEXT REQUIRED  The name of the project.
  version TEXT [0.0.0]        The version to store in the project file.

Options:
  -h,--help                   Print this help message and exit
  -p <PATH> REQUIRED          The root path to create the project in.
  -n TEXT REQUIRED            The name of the project.
  -v TEXT [0.0.0]             The version to store in the project file.

so yes, to me this makes sense if we remove positionals.

@ScottBailey
Copy link
Contributor

See also PR #54

@ScottBailey
Copy link
Contributor

As I understand with ->type_name_fn([]()->std::string{ return "<PATH>"; }); it will looks like:

Options:
  -h,--help                   Print this help message and exit
  -p <PATH>                   Path containing the project's yaml file.

I think so? More testing is required.

@stephenpdeos
Copy link
Member

May be completed by #13 , will close after merge if so

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Todo
Development

No branches or pull requests

4 participants