derry
derry copied to clipboard
Allow default for nested command
Is there a way to allow a default when using nested commands?
// syntax seems not allowed in yaml (from IDE message in vscode, not personally sure)
scripts:
gen: dart run build_runner build
del: dart run build_runner build --delete-conflicting-outputs
// this syntax is allowed, but can't call the default with derry
// (or even if I knew how, it wouldn't be more convenient than just giving it a name
scripts:
gen:
: dart run build_runner build
del: dart run build_runner build --delete-conflicting-outputs
// maybe some way of making this work?
scripts:
gen:
- dart run build_runner build
- del: dart run build_runner build --delete-conflicting-outputs
// or maybe derry can just reserve the name "default"?
scripts:
gen:
default: dart run build_runner build
del: dart run build_runner build --delete-conflicting-outputs
Looking at the second style above, I think if derry gen
could run the script with no name that would be cool - assuming there are no other issues with this approach.
Options 2/4 look the best and can probably be supported both at the same time.
yes this appears supported, i use the (scripts):
on every one because i also want to have (description):
on each one so my derry ls -d
/ derry ls --description
is useful.
# this example of my version bumper, let's call this scripts.yaml and add it to the pubspec.yaml
test:
(description): perform unit tests
(scripts):
- flutter test -r expanded
# https://codewithandrea.com/articles/flutter-test-coverage/
coverage:
(description): produces coverage report to default coverage/lcov.info and we use genhtml to create report in coverage/html
(scripts):
- flutter test --coverage
- genhtml coverage/lcov.info -o coverage/html
- open coverage/html/index.html
report:
(description): produces test report to test_report/latest.json
(scripts):
- flutter test --reporter json --file-reporter "json:test_report/latest.json"
then try:
derry ls -d
derry test
derry test coverage
derry test report
@sonjz Nice thinking, thanks for sharing!
It would be nice for my example 2 or 4 to work since it's a bit less noise, but this seems like a workable alternative.