Comments (8)
Well - it is nice to see that bashly is easy enough to use that you have built (or planning to build) such a large bash script with it.
There is a command.filename
option which lets you specify the path (in src
) for each command. Isn't this sufficient?
See:
- command.filename on bashly docs
- Command Filenames example
$ bashly doc command.filename
But now that I look a all this, I agree - it is tedious, and I am not a big fan of the fact that so many filenames end with *_command.sh
.
I am going to try to do the following:
Have a setting in the settings.yml
to say something like command_paths: nested
that will set the path of a command docker status
to src/commands/docker/status.sh
instead of src/docker_status_command.sh
Makes sense?
from bashly.
It is beautiful right?
It is 👍 ❤️
from bashly.
Released in 1.0.7
Docs: https://bashly.dannyb.co/usage/settings/#commands_dir
This was a nice one Nicolas, thanks.
from bashly.
We've indeed been doing this manually the whole time for our (also pretty large) script :) Thanks for adding this!
from bashly.
Have a setting in the
settings.yml
to say something likecommand_paths: nested
that will set the path of a commanddocker status
tosrc/commands/docker/status.sh
instead ofsrc/docker_status_command.sh
Makes sense?
Sure!
But I don't know how your last PR will solve this issue? #399
from bashly.
The PR adds a setting value, that when set, will automatically organize all the commands in the src folder, in subdirectories.
See this example.
Points of interest:
bashly/examples/command-paths/settings.yml
Lines 1 to 7 in e94a65f
https://github.com/DannyBen/bashly/tree/master/examples/command-paths/src/commands
And, if you have sub-sub-commands - like cli docker image ls
, its file will be src/commands/docker/image/ls.sh
Meaning: The setting not only sets a sub directory for commands, but it also changes the entire path generation logic.
Isn't this what you wanted?
You can use the edge version to test it.
from bashly.
You can use the edge version to test it.
I did with
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'bashly', github: 'DannyBen/bashly'
It works :)
├── commands
│ ├── completions.sh
│ ├── concerto
│ │ ├── config_dump.sh
│ │ ├── config_print.sh
│ │ ├── notify_release.sh
│ │ ├── notify_sentry.sh
│ │ ├── restart.sh
│ │ ├── setup.sh
│ │ ├── update_french_logo.sh
│ │ └── update_staging.sh
│ ├── docker
│ │ ├── config.sh
│ │ ├── down.sh
│ │ ├── enter.sh
│ │ ├── exec.sh
│ │ ├── images.sh
│ │ ├── logs.sh
│ │ ├── prune_images.sh
│ │ ├── ps.sh
│ │ ├── pull.sh
│ │ ├── restart.sh
│ │ ├── start.sh
│ │ ├── stop.sh
│ │ ├── top.sh
│ │ └── up.sh
│ ├── get-config
│ │ ├── concerto-version.sh
│ │ ├── date.sh
│ │ ├── debian-version.sh
│ │ ├── env.sh
│ │ ├── local.sh
│ │ └── service-version.sh
│ ├── maintenance
│ │ ├── start.sh
│ │ ├── status.sh
│ │ └── stop.sh
│ ├── postgres
│ │ ├── backup.sh
│ │ ├── psql.sh
│ │ ├── reindex.sh
│ │ ├── restore.sh
│ │ └── vacuum.sh
│ ├── rails
│ │ ├── console.sh
│ │ └── rake.sh
│ └── redis
│ └── cli.sh
At first I was surprised by the commands
dir but it's consistent with the lib
dir sitting next to it.
Thank you! It works great!
from bashly.
It is beautiful right? Much better for large scripts.
Thanks for suggesting it. I am updating the example so it is clearer that commands get subdirectories as well.
from bashly.
Related Issues (20)
- Allow default array when repeatable is true HOT 9
- Add support for array in `flag.default` and `arg.default` schema HOT 1
- JSON schema validation passes when it shouldn't HOT 12
- Add JSON schema tests to ensure the validation fails when it should HOT 1
- Whitelisted arg with default from environment HOT 6
- Add `environment_variable.allowed` whitelist HOT 1
- Update `inspect_args` to also print managed environment variables HOT 1
- Docker container does not have pandoc installed HOT 2
- Do not render `inspect_args` when `env` is set to `production` HOT 2
- Add key-value parameters HOT 6
- Add support for recursive --help HOT 6
- Build multi-arch docker HOT 2
- Default argument is not validated HOT 6
- Flag arguments with a single hyphen prefix are not working HOT 1
- bash completions can't work properly when the position args used 'allowed:' HOT 3
- Repeatable args don't escape quotation marks HOT 12
- Add option to disable splitting of flags with value for catch_all arguments HOT 9
- Lifecycle for temporary directories HOT 1
- Heredoc indentation issue in bashly generated functions. HOT 9
- The Flag value is detected as an Argument HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bashly.