jacobdeichert / mask

🎭 A CLI task runner defined by a simple markdown file
MIT License
1.11k stars 55 forks source link

Remove commands without code blocks #70

Closed twitu closed 4 years ago

twitu commented 4 years ago

Which issue does this fix?

Closes #65

Describe the solution

Recursively remove commands that do not have any code block and have no subcommands. Retain root level command with level == 1.

twitu commented 4 years ago

If this recursive pruning of the command tree is an acceptable solution. I can add a few test cases and fix ones that conflict with this change.

jacobdeichert commented 4 years ago

@twitu thanks for the PR! I like the solution, it's very clean 👍

If you can add some tests, that would be great.

Also looks like one test is failing, does_not_add_verbose_optional_flag_to_command_with_no_script but we can delete that test as it's no longer needed with this fix.

twitu commented 4 years ago

I have modified two test cases to fit pruning of commands. However there are also three tests in subcommands_test.rs that are failing. I am not sure if these tests are relevant any longer. How to handle them?

Also I have a question regarding additional tests. Should I write tests that simulate user input or ones that simply check the command_tree structure for retained commands? Also which file is the most appropriate place to put these tests?

jacobdeichert commented 4 years ago

@twitu this is great! I'll get a new version released soon.

jacobdeichert commented 4 years ago

I'll release this after I figure out this https://github.com/jakedeichert/mask/pull/64 👍