fentas / argsh Goto Github PK
View Code? Open in Web Editor NEW:shell: Argument parsing for all interpreter languages.
Home Page: https://arg.sh
License: MIT License
:shell: Argument parsing for all interpreter languages.
Home Page: https://arg.sh
License: MIT License
As a developer I like to know whats new in a project. So having a changelog, which builds the base for the release notes lets me see what i need to know.
# ...
# --- ACTIONS
# argsh(D|script1-d-action): des(Do something.)
# argsh(L|script1-l-action): des(Do something.)
# ...
# ...
# --- ACTIONS
# argsh(D|script2-d-action): des(Do something.)
# ...
script2_d_action() {
script1 -L
}
script2 -D
script1 -D
inside script2_d_action
instead of script1 -L
As a developer I want to be able to define options which are required to be passed to run an action.
# example for defining it in the actions definition
# req --> requires
# args(F|floating-ips-delete): des(Create the passed floating ips.) req(p,c)
# example for defining it in the options definition
# reqb --> required by
# args(p|playbook-name): opt(PLAYBOOK_NAME) def(test) des(The playbook name.) val() reqb(D)
As a developer i like to know the test percentage of test coverage of my tests. So it would be nice to have test coverage integrated for argsh.
As a developer i need to know how to use argsh in my project. So this needs to be documented.
As a developer i want to test the code i write. So it would be nice to be able to run tests with a single command.
argsh -T -t path/to/tests
(use bats)As a developer i need to read the help of a script as fast as possible to be able to save time. So the printed out help text should be properly formatted.
# shellcheck shell=bash
# ...
On a fresh installed ubuntu mawk seems to be installed defaultwise. Using mawk leeds to following error
awk: .../argsh/libexec/argsh/libs/parse.awk: line 7: syntax error at or near ,
awk: .../argsh/libexec/argsh/libs/parse.awk: line 10: syntax error at or near ,
awk: .../argsh/libexec/argsh/libs/parse.awk: line 20: syntax error at or near }
Maybe solve or put into the readme.
As a developer, it sometimes happens that i need to see which values the options i passed to script have. For being able to see that effortlessly, it would be nice to have a functions which prints out this information using a readable format.
# example 1: print one option
hetzner --debug-options SERVER_TYPE
SERVER_TYPE: environment: <empty>; default: 'cx11'; passed: 'cx21'; current: 'cx31'
# example 2: print all options
hetzner --debug-options
As a developer I cant remember all flags of all scripts / tools i use. So it would be nice to have command line completion for the scripts i create with argsh.
As developers we want to be as efficient as possible when writing bash scripts. So we standardized writing bash scripts for the project with args.sh to make the code more readable and easier to extend. To reinforce these goals we need some additional features, which we will collect here. When working on a feature request, the choosen one will be stripped out of this collection issue to a own working issue.
As a developer i want to ensure, that the user of an option only passes valid values to that option. Therefore there has to be a validator, which ensures that no invalid options are passed.
# example
# args(s|server-type): opt(SERVER_TYPE) def() des(The playbook name.) val(_args_is_in_array(cx21,cx11))
As a developer i sometimes want to avoid a option/action being parsed by args.sh. So i need be able to indicate that a option/action shouldn't be parsed.
# example: use two number signs at the beginning of a line
## args(p|playbook-name): opt(PLAYBOOK_NAME) def(test) des(The playbook name.) val() reqb(D)
As a developer i regularly create new scripts. So it would be nice to have a argsh cli tool which helps me with the repeating tasks i have to do while using argsh. As argsh is a cli tool creation helper it could "eat its own dog food".
As a developer I cant always remember, which option or action is doing what. So it would be nice to be able to call man <script_name>
to see what a script is able to do.
Similarly to direnv, make it possible to pass a .env file which could look like that:
.env
#!/bin/bash
export TEST_ENV=abc
script1 --config-file .env
It would be nice to have these environment variables available in the called argsh script script1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.