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

Command-line flags #11

Closed
weierophinney opened this issue Jun 11, 2015 · 11 comments
Closed

Command-line flags #11

weierophinney opened this issue Jun 11, 2015 · 11 comments

Comments

@weierophinney
Copy link

We're planning on using Bookdown for the documentation of the various Zend Framework components. One thing I'd like to be able to do is have a bare-minimum bookdown.json that specifies the title and content, and optionally the default target, and then specify the template (and possibly the target) via a command-line flag. This would allow us to have the "official" templates in a top-level repo that aggregates documentation from each of the components, but also allow developers to render the documentation using that template if it's checked out somewhere on their filesystem:

$ bookdown --template=../documentation/templates/main.php doc/bookdown.json

Or, to override the target:

$ bookdown \
> --template=../documentation/templates/main.php \
> --target=../documentation/html/ \
> doc/bookdown.json
@pmjones
Copy link
Contributor

pmjones commented Jun 13, 2015

/me nods

Given config file and option flag, which do you think should take precedence? (I'd say option flag.)

@weierophinney
Copy link
Author

Definitely option flag; that's the most specific, as it's specified at time
of invocation.
On Jun 13, 2015 1:50 PM, "Paul M. Jones" notifications@github.com wrote:

/me nods

Given config file and option flag, which do you think should take
precedence? (I'd say option flag.)


Reply to this email directly or view it on GitHub
#11 (comment)
.

@pmjones
Copy link
Contributor

pmjones commented Jun 13, 2015

Agreed. Let me see what I can do. (Additionally, if you have time and inclination to work up a PR, I'll review it.)

pmjones pushed a commit that referenced this issue Jun 14, 2015
@pmjones
Copy link
Contributor

pmjones commented Jun 14, 2015

This should be fixed; try the dev-develop branch and let me know how it goes for you.

@pmjones pmjones closed this as completed Jun 14, 2015
@pmjones pmjones reopened this Jun 14, 2015
@pmjones
Copy link
Contributor

pmjones commented Jun 14, 2015

Nope, not yet -- sorry for the noise.

@pmjones
Copy link
Contributor

pmjones commented Jun 14, 2015

@weierophinney OK, now try dev-develop. You should be able override with --template= and/or --target= at will.

@pmjones pmjones closed this as completed Jun 14, 2015
@weierophinney
Copy link
Author

I can confirm it works... but there's one oddity. :)

So, I have a directory structure that has the following:

documentation/
    doc/
        templates/
a-component/
    doc/
        bookdown.json
        book/

Inside of a-component/, I invoked bookdown with the following:

$ bookdown --template=../documentation/doc/templates/main.php doc/bookdown.json

This failed; it could not find the template:

Cannot find template 'doc/../documentation/doc/templates/main.php'.

In other words, it was resolving the relative path relative to the bookdown.json, not where bookdown was actually invoked.

I would expect it to resolve the path based on where the script was invoked. This would require resolving path arguments prior to parsing the bookdown.json, probably.

(When I re-ran and specified the path relative to the bookdown.json, it worked perfectly.)

@pmjones
Copy link
Contributor

pmjones commented Jun 15, 2015

Mmm, I can guess what the problem is. I'll take a look.

@pmjones pmjones reopened this Jun 15, 2015
@pmjones
Copy link
Contributor

pmjones commented Jun 15, 2015

OK @weierophinney give it another go. The relevant commit is dee1f42 and takes away the code to "fix" the path to make it relative to the bookdown.json file.

@weierophinney
Copy link
Author

Works perfectly, @pmjones ! 🚢 !!!

@pmjones
Copy link
Contributor

pmjones commented Jun 15, 2015

Finally. Sorry for the hassle, and thanks for your patience. New release forthcoming as a result!

@pmjones pmjones closed this as completed Jun 15, 2015
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