Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,6 +84,7 @@ Command | Description
`climate countdown <seconds>` | a countdown timer
`climate stopwatch` | a stopwatch
`climate ix` | pipe output to ix.io
`climate seashells` | pipe output to seashells.io in real-time
<br> |
`climate biggest-files [path]` | find the biggest files recursively
`climate biggest-dirs [path]` | find the biggest directories
Expand Down
12 changes: 12 additions & 0 deletions climate
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -168,6 +170,10 @@ ipinfo() {
printf "${GREEN_BOLD}Latitude/Longitude: ${YELLOW}${json_loc}\n"
}

seashells() {
tee >(nc seashells.io 1337)
}

# ----------------------------------------------------------------------------
# Parse Args

Expand Down Expand Up @@ -207,6 +213,7 @@ help=$(
shelp "countdown <seconds>" "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"
Expand Down Expand Up @@ -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

Expand Down
47 changes: 47 additions & 0 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion readme-generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down