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

Switch to use JCommander #110

Closed
jonbullock opened this issue May 11, 2014 · 5 comments
Closed

Switch to use JCommander #110

jonbullock opened this issue May 11, 2014 · 5 comments
Assignees
Milestone

Comments

@jonbullock
Copy link
Member

Switch to use JCommander for command line interface. Supports having specific inputs per option rather than sharing inputs across all options.

@jonbullock jonbullock added this to the future milestone May 11, 2014
@jonbullock jonbullock self-assigned this May 11, 2014
@lefou
Copy link
Member

lefou commented Jul 15, 2014

What exactly do you mean by "having specific inputs per option"? Could you give an example or a list of affected options/inputs?

@jonbullock
Copy link
Member Author

I'd like to have usage such as:

-b
-s

At the moment both and share the same variable in code which has been problematic. I'd like to have dedicated variables for each 'option' (i.e. -b -s). Originally I didn't believe this was possible with Args4j but having looked at this again it may be possible after all. This task should really be evaluate the best library for JBake's needs.

@lefou
Copy link
Member

lefou commented Jul 23, 2014

So, you mean, instead of the two generic parameters for source and destination, you want them to be part of the -b option. Also you want the -s (server) option be have one parameter for the directory to be served. Thanks for clarification.

Last week I played with it a bit and built the following command line (based on CmdOption, not JCommander) which does not contain these ideas outlined above:

Usage: jbake [options]

Options:
  --bake,-b                       start baking (this is the default action if no option is supplied)
  --destination,-d <destination>  destination folder for output, if not supplied will default to a
                                  folder called "output" in the current directory
  --help,-h                       prints this message
  --init,-i                       initialises required folder structure with default templates
  --reset                         clears the local cache, enforcing rendering from scratch
  --server,-s                     runs HTTP server to serve out baked site, if no <value> is
                                  supplied will default to a folder called "output" in the current
                                  directory
  --source <source>               source folder of site content (with templates and assets), if not
                                  supplied will default to current directory
  --verbose,-v                    be more verbose

As you can see, the source and destination parameters are already options, but are not specific to the bake resp. server options. This code is located in this branch: https://github.com/lefou/JBake/tree/cmdoption

I will soon create another branch with this new idea you just outlined. Of course, the above command line can also be created with JCommander or any other command line parser tool, i guess.

Also, let me know if you prefer the short options (-b) over the long ones (--bake). In this case, I would adapt the usage (--help) accordingly.

@lefou
Copy link
Member

lefou commented Jul 23, 2014

If we move the parameters into the -b option, they are no longer optional. Currently, and in the branch I mentioned in the last comment, they are.

@jonbullock
Copy link
Member Author

Closing in favour of #572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants