8ware / adhocsh Goto Github PK
View Code? Open in Web Editor NEWAn ad-hoc shell for subcommand-based CLI programs
An ad-hoc shell for subcommand-based CLI programs
To distribute and install adhocsh more easily the project should be restructured to fit the typical Python package structure. This includes a Python module and a script using the module which both can be installed via pip using an appropriate setup.py
. Testability will be increased as well.
Many sub-commands accept parameters to change their behavior, e.g. git status .
or git log --name-status
. Allow to parameterize the default command.
Inbetween adhocsh sessions the command history is lost. The readline
module provides methods to handle command line history. Configure readline
to store command history. For example, $XDG_DATA_HOME/adhocsh/<command>.history
.
Provide an option to enable directory specific history. The history filename has to be adjusted to account for $PWD
. Since some characters have to be encoded (e.g. /
) a hash of the $PWD
could be used. For example, the path /home/xxx/dev/adhocsh
can be encoded with MD5 as git-15c459cee1c51105b2b787d98dd90626.history
.
Although completion leads the way to well-formed commands errors due to missing arguments and the like can still occur. Since error messages might be surrounded by other output an indicator concerning the exit status would be useful.
Colorize the prompt at least for $! > 0
.
There are some specialized prompts, e.g. for Git and Taskwarrior, which show useful information. Unfortunately, if an error occurs during rendering of such a prompt the shell will exit immediately. Provide a fallback prompt to avoid unintended exit.
Aside from quotes, expansion of special characters like *
or {}
is sometimes useful, sometimes not. For example, using wildcards to specify a set of files to be committed in Git is pretty convenient. On the other hand, escaping all decorative characters is annoying when a phrase of an Taskwarrior item should be emphasized (e.g. *
), quoted or bracketed (e.g. ()
).
To activate shell expansion depending on the use case an option should be added.
Bug can be reproduced as follows:
$ ./adhocsh git
> commit -m "
[...]
Traceback (most recent call last):
File "./adhocsh.py", line 240, in <module>
print ("Error: " + e.message)
^^^^^^^^^
AttributeError: 'ValueError' object has no attribute 'message'
There is an issue in the fallback file completion (used if no matches are generated by the primary Bash completion script) which omits the directory component of files in sub-directories. For example, the git> diff tests/exa<TAB>
will result in git> diff example.py
.
Can be reproduced as follows:
touch "foo bar" "foo baz"
$ ./adhocsh.py git -f __git_wrap__git_main
git add fo<tab>
Python 2 has reached end of life on January 1st, 2020 [src]. Adhocsh needs to migrate to Python 3.
The current implementation always tries to complete the last argument. Allow completion w.r.t. the current cursor position.
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.