Hopefully it will eventually come true in ten years. :)
Current State: Primitive.
Some might not be related with Unish, but with Linux or in general with POSIX or UNIX.
How to
tilsuc: Unattended download of videos over unstable connection.Note: There is a shell script now, at commands/tilsuc.sh.
It seems more appropriate to add a
sleepin thewhileloop, when the main command doesn't support immediate re-entrance.tilsuc() { while true; do "${@}"; if [[ $? -eq 0 ]]; then break; fi; sleep 1; done; }; tilsuc youtube-dl --proxy 'socks5://127.0.0.1:1080' 'http://www.pbs.org/newshour/episode/pbs-newshour-full-episode-feb-24-2017/'If you have many Git repositories, this one-liner might come in handy.
Note that all my repositories are named in this format, '<name>.<vcs>'. For instance,
unish.git,unish.hgandunish.svn.find -maxdepth 1 -name '*.git' -exec sh -c 'cd {} && git status' \;Clean up compiled Python files before packaging or distributing.
find -name '*.pyc' -delete && find -name '__pycache__' -delete
I tend to use this
pylintrecently.E.g,
1000, to which pylint defaults, is not a good candidate for maximum line count, whereas999or9999is.Guess what?
I refuse to pay the space of a single character,
len('1000') - len('999'), for a single line,1000 - 999, when my editors always have line numbers on.pylint --reports n --output-format colorized --disable=missing-docstring,too-few-public-methods,too-many-ancestors,broad-except,invalid-name,too-many-locals,too-many-arguments,too-many-instance-attributes,too-many-public-methods,too-many-lines,too-many-branches,too-many-statements,duplicate-code
Unish may work only in Zsh 5.2 & Bash 4.3. You have been warned.
You are not recommended to use Unish directly. (It sucks :(.) Instead, absorbing or extracting and adapting some bits or pieces that fit in your needs.
But it's not abandoned and will be updated regularly as I experiment on various fancy stuffs.
Intentional command-not-found handler
Work in progress, prototype available.
For more details, see
py/found.py,py/fdb.py, as well as the command-not-found handling functions.
py/found.py and related code now reside in UrlMark.
$ # Search in Google or Bing, and many others. $ @google Who is the president of US $ @bing Who is the president of US $ # Open a website. $ @github $ # Search in dictionaries. $ @oxford pulchritude $ @urban '<3'
Smart Commands (Growing)
Commands with knowledge of their invocation environment and behave accordingly.
See the dedicated section below.
Logging Layer (Primitive)
I'm addicted to logs, and dream of writting fantastic ones, which give me a feeling that my code is more of myself, a human being, rather than some strange pieces run inside a cold machine.
Because it's me that wrote it!
Built-in Help Layer (Primitive)
Created by a previous Bash user who missed that handy
helpbuiltin and appreciated the fantasticrun-helpin Zsh world.Documentation generator (Ongoing)
I hate documentation that isn't generated from code.
Known exceptions: readme, changelog as well as commit messages.
Plugin Layer (Planned)
Clone this repository
git clone https://github.com/NoviceLive/unish.gitorgit clone --recursive https://github.com/NoviceLive/unish.gitClone recursively if you want the bundle packages as listed below.
Use the included
makefileto prepare symbolic linksmake zshormake bashWarning: Check the
makefilebefore typingmake.Backup your original ~/.zshrc or ~/.bashrc if necessary.
Alternatively, you can just
sourcetheentry.shof Unish.Both Zsh and Bash are supported.
Suggestion: use
export DISABLE_UNISH_PLUGINS=1before you source to avoid unintentional side effects.Happy Tweaking!
Take cd for instance, we think it smart when it:
cdinto the directory containing the given fileif it's invoked with a single argument which is a file. For example,
cd /etc/fstabbehaves ascd /etc.runs
git statusorhg statusaftercdif it knows that the directory is a Git or Mercurial repository.
displays files up to a default count in the given directory
when it finds nothing special about that direcotry.
As matter of fact, we are able to add smartness further, for instance, integrating autoenv or smartcd.
Unish provides integration (wrapping)
of some useful daily utilities,
for example, ssh-agent and tmux.
ssh-agentssh-agentwill be started if available when Unish is ready.You can use
addkeyfunction to add keys.-
If Unish finds tmux, it will be started with the default session named
main.afunction can be used to attach to the most recent session, or create a new sessionmainif there is none.
dogColorized
cat(Actuallyless) if applicable.This requires highlight or pygmentize.
lsgitandupgitlsgit: Check the status of git repositories in the specified directory.
upgit: Update the specified git repositories.
And variants,
lshg,uphg, etc. Seehelp lsgitandhelp upgit.lsmd5andrmmd5lsmd5: List the md5sum of files (but without filenames) in the specified directory.
rmmd5: Remove the files with the specified md5sum.
And its siblings,
lssha1,lssha224,lssha256,lssha383,lssha512and the correspondingrmversions.See
help lsmd5for more.catmp3Concatenate mp3 files in the specified directory.
And its brothers,
catflv,catmp4, etc. Seehelp catmp3.It requires ffmpeg.
summp3Calculate total duration of mp3 files in the specified paths.
And its brothers,
sumflv,summp4, etc. Seehelp summp3.It requires ffmpeg.
Copyright 2015-2016 Gu Zhengxiong <[email protected]>
Unish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.