GithubHelp home page GithubHelp logo

adtac / climate Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 76.0 63 KB

The swiss-army knife of utility tools for Linux.

License: GNU General Public License v3.0

Shell 90.74% Python 9.26%
bash command-line developer-tools linux shell zsh

climate's People

Contributors

adtac avatar akasurde avatar gurkengewuerz avatar leozhang2018 avatar tbobm avatar theldus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

climate's Issues

extract completions into seperate files

this would be a massive help in being able to package climate using alternative package managers such as pacman. in the install script, completions mutate config files. it would be better to simply have the completions be seperate, so they can be installed to /usr/share/zsh/site-functions

Use GPL and not AGPL license

Usually AGPL is used for applications that are only used on a server (i.e., aren't downloaded to the end user). I think AGPL is not appropriate for a shell helper tool, so this is a request to change the license to GPL (or MIT/BSD) to be friendlier to places where AGPL may not be allowed.

When trying to update

When I type climate update I dot this:

sh: 162: [[: not found
sh: 166: [[: not found
┌───────────────────┐
│ climate installer │
└───────────────────┘
sh: 180: [[: not found
sh: 188: Bad substitution

support for nvm

Hey,
I just tried to install this script. During the installation progress it showed me that npm is not installed. But I have npm installed using nvm (https://github.com/creationix/nvm)
Running node -v and npm -v gives from both the version back.

Would be awesome if the script recognises this.

Have a nice day :)

Lots of minor coding issues.

Nice script, I find some of the ideas are pretty clever. Consider running it through shellcheck, lot of low hanging fruits in there.

Issues:

For portability reasons (I don't mean BSD and others, there are linux distros in the wild not having bash under /bin/bash):

-#!/bin/bash
+#!/usr/bin/env bash

Every day is a good day to learn something new. The variable is not used anyway.

-ABSOLUTE_PATH="$(cd "$(dirname "${0}")" && pwd)/$(basename "${0}")"
+ABSOLUTE_PATH="$(readlink -nf "${0}")"

Avoid variable leaking (example below).

 spinner() {
-    spin="\\|/-"
-    i=0
+    local spin="\\|/-"
+    local i="0"
bar() {
    foo='Hello world!'
}
bar
echo "${foo}"

Always quote variables to avoid splitting.

-while kill -0 $1 2>/dev/null; do
+while kill -0 "$1" &>/dev/null; do

Variables shouldn't be used as printf formatting string

-        printf "\b${spin:$i:1}"
+        printf "\b%s" "${spin:$i:1}"

There is no reason to use single square brackets test. In bash always use double. Also quotes.

 extract () {
-    if [ -f $1 ] ; then
-        if [[ $2 == "" ]]; then
-            case $1 in
-                *.rar)                             rar x   $1       ${1%.rar}/        ;;
+    if [[ -f "$1" ]] ; then
+        if [[ "$2" == "" ]]; then
+            case "$1" in
+                *.rar)                                  rar x   "$1"    "${1%.rar}/"     ;;

Reading from $1 and $2 and shifting is cleaner than double-shift.

 replace() {
-    find_this="$1"
-    shift
-    replace_with="$1"
-    shift
+    local find_this="$1"
+    local replace_with="$2"
+    shift 2

Awk is magic; quotes.

-    PERCENTAGE=$(upower -i $(upower -e | grep battery) |
-                 grep "percentage" |
-                 grep -o "[0-9]*")
+    PERCENTAGE=$(upower -i "$(upower -e | grep battery)" |
+        awk -F: '/percentage/{gsub(/^\s+|\s+$/, "", $2); print $2}')

Backticks are evil, use $(). Also putting --utc near every date in script may be a good idea (yeah, yeah, I know it's %s).

-    date1=$((`date +%s` + $commandargs));
+    local start_date="$(date --utc '+%s')"
+    local stop_date="$(( $now + $commandargs ))"

typo in user-stats?

Should the 2nd if check for $commandargs instead?

elif [[ $command == "user-stats" ]]; then
    if [[ $command != "" ]]; then

UTC and ISO 8601 support

UTC is the time than all other timezones deviate from. ISO 8601 is an international standard for displaying the time and date.

UTC is used a lot to keep international organisations in sync. It allows global communications without ambiguity. The ISO 8601 date standard is similarly used to remove ambiguity. An example ISO 8601 date is 2017-01-17T18:03:26. The most significant part of the date is placed first. This means files can be much more easily sorted. It is supposed to remove ambiguity from dates (e.g. American dates are structured as MM-DD-YY, while European dates are DD-MM-YY).

I think it is a good idea to implement UTC and ISO 8601 support. The command affected are time and clock. I think it would be ideal to have flags like the command date does, where date --utc returns Tue 17 Jan 18:53:03 UTC 2017. The user should be able to use the two flags together.

Overall this would improve global communications for millions (ok, a couple) of people :)

enhancement: pipe to clipboard

Could be worth implementing a new climate clip or a climate c command similar to climate ix that pipe stuff on the clipboard?

alias clipboard='xclip -sel clip'

illegal date

climate stopwatch
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

climate didn't warn me it will install a lot of crap


 • upower exists!
 • curl exists!
 • rar missing. Installing... Installed!
 • unzip exists!
 • 7z missing. Installing... Installed!
 • xdg-screensaver exists!
 • dig exists!
 • git exists!
 • python exists!
 • pip missing. Installing... Installed!
 • node missing. Installing... Installed!
 • npm missing. Installing... Installed!
 • fdupes missing. Installing... Installed!
 • glances missing. Installing... Installed!
 • sensors exists!
 • sshfs missing. Installing... Installed!
 • gawk missing. Installing... Installed!
 • jq missing. Installing... Installed!
 • http-server missing. Installing... Installed!
 • is-up missing. Installing... Installed!
 • is-online missing. Installing... Installed!
 • speedtest missing. Installing... Installed!
 • httpstat missing. Installing... Installed!

I DIDN'T NEED that. How to uninstall all of that?

sudo apt-get purge node

doesn't work

Improvements to the clock command

I really enjoy the clock command but because of it's implementation it has some things that are a bit annoying. First, it would be nice to have a command to remove the clock. Currently the only way is to kill the process manually or by killing the terminal window. Also, since it uses the tput command, it is not possible to scroll on your terminal, because it is constantly refreshing. Just some thoughts.

Great little app btw!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.