diff --git a/README.md b/README.md index ba5eaae..8b212f4 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ After that's done, run `climate` to see the whole list of commands supported. `climate` has the following dependencies: ``` -upower wget curl rar unzip 7z dig git python pip node npm fdupes glances speedtest sensors sshfs http-server httpstat is-up +upower wget curl rar unzip 7z dig git python pip node npm fdupes glances speedtest sensors sshfs http-server httpstat is-up rpm2cpio cpio ``` The installation command should automatically install these for `apt`-based systems @@ -84,6 +84,7 @@ Command | Description `climate countdown ` | a countdown timer `climate stopwatch` | a stopwatch `climate ix` | pipe output to ix.io + `climate seashells` | pipe output to seashells.io in real-time
| `climate biggest-files [path]` | find the biggest files recursively `climate biggest-dirs [path]` | find the biggest directories diff --git a/climate b/climate index 3c7e4ea..86a9b57 100755 --- a/climate +++ b/climate @@ -80,6 +80,7 @@ extract () { *.tgz) mkdir -p ${1%.tgz} && tar xzf $1 -C ${1%.tgz}/ ;; *.zip) unzip $1 -d ${1%.zip}/ ;; *.7z) 7za e $1 -o${1%.7z}/ ;; + *.rpm) mkdir -p ${1%.rpm} && rpm2cpio $1 | (cd ${1%.rpm} && cpio -idmv) ;; *) printf "${RED}'$1' cannot be extracted.\n" ;; esac else @@ -93,6 +94,7 @@ extract () { *.tgz) mkdir -p $2 && tar xzf $1 -C $2 ;; *.zip) unzip $1 -d $2 ;; *.7z) 7z e $1 -o$2/ ;; + *.rpm) mkdir -p $2 && rpm2cpio $1 | (cd $2 && cpio -idmv) ;; *) printf "${RED}'$1' cannot be extracted.\n" ;; esac fi @@ -168,6 +170,10 @@ ipinfo() { printf "${GREEN_BOLD}Latitude/Longitude: ${YELLOW}${json_loc}\n" } +seashells() { + tee >(nc seashells.io 1337) +} + # ---------------------------------------------------------------------------- # Parse Args @@ -207,6 +213,7 @@ help=$( shelp "countdown " "a countdown timer" shelp "stopwatch" "a stopwatch" shelp "ix" "pipe output to ix.io" + shelp "seashells" "pipe output to seashells.io in real-time" printf "\n${PLAIN_BOLD}Files:\n" shelp "biggest-files [path]" "find the biggest files recursively" @@ -430,6 +437,11 @@ elif [[ $command == "stopwatch" ]]; then elif [[ $command == "ix" ]]; then ix +# ---------------------------------------------------------------------------- +# seashells.io +elif [[ $command == "seashells" ]]; then + seashells + # ---------------------------------------------------------------------------- # Recursively find the biggest files in the given directory diff --git a/install b/install index 5256c40..254f510 100755 --- a/install +++ b/install @@ -184,6 +184,51 @@ cat > $CLIMATE_COMPLETION << EOF then COMPREPLY=( \$(compgen -W "\${opts}" -- \${cur}) ) fi + + if [ \$COMP_CWORD == 2 ] + then + case "\$prev" in + "biggest-files"|"biggest-dirs"|"dir-size"|"remove-empty-dirs"|"find-duplicates"|"ssh-unmount"|"upload") + compopt -o nospace -o dirnames; + return 0 + ;; + "monitor") + COMPREPLY=(\$(compgen -f -- \${cur})) + compopt -o nospace -o filenames; + return 0 + ;; + "extract") + COMPREPLY=(\${COMPREPLY[@]} \$( compgen -d -- \$cur )); + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.rar' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tar.bz2' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tar.gz' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tar.xz' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tar' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tbz2' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tgz' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.zip' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.7z' -- \"\$cur\" )) + COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.rpm' -- \"\$cur\" )) + compopt -o nospace -o dirnames -o filenames; + return 0 + ;; + *) + ;; + esac + fi + + if [ \$COMP_CWORD == 3 ] + then + action="\${COMP_WORDS[COMP_CWORD-2]}" + case "\$action" in + "extract") + compopt -o nospace -o dirnames; + return 0 + ;; + *) + ;; + esac + fi } complete -F _climate climate EOF @@ -295,6 +340,8 @@ main() { system_verify "sshfs" "sshfs" "fuse-sshfs" system_verify "gawk" "gawk" "gawk" system_verify "jq" "jq" "jq" + system_verify "rpm2cpio" "rpm2cpio" "rpm2cpio" + system_verify "cpio" "cpio" "cpio" npm_verify "http-server" "http-server" npm_verify "is-up" "is-up-cli" diff --git a/readme-generate.py b/readme-generate.py index 49d37b1..9eb9258 100755 --- a/readme-generate.py +++ b/readme-generate.py @@ -57,7 +57,7 @@ `climate` has the following dependencies: ``` -upower wget curl rar unzip 7z dig git python pip node npm fdupes glances speedtest sensors sshfs http-server httpstat is-up +upower wget curl rar unzip 7z dig git python pip node npm fdupes glances speedtest sensors sshfs http-server httpstat is-up rpm2cpio cpio ``` The installation command should automatically install these for `apt`-based systems