-
Notifications
You must be signed in to change notification settings - Fork 426
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
[Feature Request] Structure .driverc #778
Comments
Hello there @jean-christophe-manciot, thank you for the feature request and for the patience. I think this is a very useful feature and I'll be using it quite a lot myself. Thank you! |
Fixes #778. Now allows you to restructure your .driverc separating commands into sections and having different clauses. Please note: * You can put multiple commands in the same section by using separator "/". See the rules at https://github.com/odeke-em/namespace/blob/0ab79ba44f1328b1ec75ea985ad5c338ba3d56a6/ns.go#L3-L14 * Overwriting of command rules is command_section > global and commandX_higher_line > commandX_lower_line where lines are natural numbers that are ascending * Exhibits: This is a sample of a .driverc that I've just defined that has flexible behavior in different sections. ``` id=true # Will be applied globally unless overwritten in a command [global] depth=10 # The depth to use if not defined [pull/list] depth=2 # The depth to be used for pull or list [push] verbose=true # verbose is only true for push [list] long=true # Allow long output for list ``` And see the tests in src/rc_test.go that lock in the promised behavior.
Fixes #778. Now allows you to restructure your .driverc separating commands into sections and having different clauses. Please note: * You can put multiple commands in the same section by using separator "/". See the rules at https://github.com/odeke-em/namespace/blob/0ab79ba44f1328b1ec75ea985ad5c338ba3d56a6/ns.go#L3-L14 * Overwriting of command rules is command_section > global and commandX_higher_line > commandX_lower_line where lines are natural numbers that are ascending * Exhibits: This is a sample of a .driverc that I've just defined that has flexible behavior in different sections. ``` id=true # Will be applied globally unless overwritten in a command [global] depth=10 # The depth to use if not defined [pull/list] depth=2 # The depth to be used for pull or list [push] verbose=true # verbose is only true for push [list] long=true # Allow long output for list ``` And see the tests in src/rc_test.go that lock in the promised behavior.
Fixes #778. Now allows you to restructure your .driverc separating commands into sections and having different clauses. Please note: * You can put multiple commands in the same section by using separator "/". See the rules at https://github.com/odeke-em/namespace/blob/0ab79ba44f1328b1ec75ea985ad5c338ba3d56a6/ns.go#L3-L14 * Overwriting of command rules is command_section > global and commandX_higher_line > commandX_lower_line where lines are natural numbers that are ascending * Exhibits: This is a sample of a .driverc that I've just defined that has flexible behavior in different sections. ``` id=true # Will be applied globally unless overwritten in a command [global] depth=10 # The depth to use if not defined [pull/list] depth=2 # The depth to be used for pull or list [push] verbose=true # verbose is only true for push [list] long=true # Allow long output for list ``` And see the tests in src/rc_test.go that lock in the promised behavior.
Fixes #778. Now allows you to restructure your .driverc separating commands into sections and having different clauses. Please note: * You can put multiple commands in the same section by using separator "/". See the rules at https://github.com/odeke-em/namespace/blob/0ab79ba44f1328b1ec75ea985ad5c338ba3d56a6/ns.go#L3-L14 * Overwriting of command rules is command_section > global and commandX_higher_line > commandX_lower_line where lines are natural numbers that are ascending * Exhibits: This is a sample of a .driverc that I've just defined that has flexible behavior in different sections. ``` id=true # Will be applied globally unless overwritten in a command [global] depth=10 # The depth to use if not defined [pull/list] depth=2 # The depth to be used for pull or list [push] verbose=true # verbose is only true for push [list] long=true # Allow long output for list ``` And see the tests in src/rc_test.go that lock in the promised behavior.
Nice ;) |
@jean-christophe-manciot it doesn't matter actually, placing a command below the other only overwrites if those commands are the same, otherwise we follow the overwriting precedence For example:
the depth in namespace global will be 1 at the end. That's different from
the depth in namespace global will be 3 at the end, the depth in namespace push will be 12 |
Also, are only <key>=<value> lines supported, or can we mimic all options available on the CLI? |
@jean-christophe-manciot on a side note, thank you very much for your contributions! I made a release and gave you a shoutout, that's the least I could do https://github.com/odeke-em/drive/releases/tag/v0.3.9. |
In regards to your request in #778 (comment), that'd be nice. Please file an issue and we'll put it on the plate for v0.4.0 as an enhancement. |
where the global keys apply until the same keys (options) are overridden by more specific values in [command_n] sections.
Then it's much easier to perform some repetitive commands.
The text was updated successfully, but these errors were encountered: