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

Better argument parsing #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Better argument parsing #147

wants to merge 1 commit into from

Conversation

ixs
Copy link

@ixs ixs commented Nov 15, 2023

Currently gh-md-toc will only do a limited job parsing arguments.

e.g. gh-md-toc --insert --hide-footer --skip-header README.md would fail as only the --insert option would be parsed as an option and the --hide-footer option would be considered the filename.

This PR adds a new parser in a loop that will parse all arguments instead.

The parser is inspired by https://stackoverflow.com/a/14203146, which solves the problem nicely.

Currently `gh-md-toc` will only do a limited job parsing arguments.

e.g. `gh-md-toc --insert --hide-footer --skip-header README.md` would fail as only the `--insert` option would be parsed as an option and the `--hide-footer` option would be considered the filename.

This PR adds a new parser in a loop that will parse all arguments instead.

The parser is inspired by https://stackoverflow.com/a/14203146, which solves the problem nicely.
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

Successfully merging this pull request may close these issues.

1 participant