notwaldorf / tiny-care-terminal

💖💻 A little dashboard that tries to take care of you when you're using your terminal.
MIT License
5.97k stars 242 forks source link

Startup helper #107

Open dhyegocalota opened 7 years ago

dhyegocalota commented 7 years ago

I've done a little shell script to put in my terminal's initial source file (.zshrc in my case):

# Tiny care terminal
export TTC_SAY_BOX="ironman"
export TTC_WEATHER="Várzea Grande, Brazil"
export TTC_GITBOT="gitlog"

function work() {
  answer="Y"

  if [[ -z "$1" || ("$1" != "-y" && "$1" != "-Y") ]]; then
    echo -n "Wanna start work? (Y/n) "
    read answer
  fi

  if [[ -z "$answer" || "$answer" = "Y" || "$answer" = "y" ]]; then
    echo -n "Tell me some local git repos (separated by comma): "
    read repos

    ttc_repos=""
    ifsbak=$IFS
    IFS=","
    for repo in `echo "$repos"`; do
      if [[ "$ttc_repos" != "" ]]; then
        ttc_repos="$ttc_repos,"
      fi
      ttc_repos="$ttc_repos$HOME/Projects/$repo"
    done
    IFS=$ifsbak

    TTC_REPOS="$ttc_repos" tiny-care-terminal
  else
    echo "Ok, if you need me, just enter 'work'. See ya..."
  fi
}

work

If it isn't helpful, please just close this issue. Regards :)

egordorichev commented 7 years ago

It would be useful, if it writes those variable exports into ~/.bash_profile.

dhyegocalota commented 7 years ago

@egordorichev exactly, that's the purporse

egordorichev commented 7 years ago

@dhyegofernando, it doesn't look like, it writes it somewhere. If you reboot, script changes will be reset.

dhyegocalota commented 7 years ago

@egordorichev yeah, it could be where it fits better for you, for me .zshrc was the target

Garbee commented 7 years ago

I think the script should be converted to node and store the vars in a way that can also be opened on Windows. That way we get cross-platform support.

mojoaxel commented 6 years ago

I think the script should be converted to node and store the vars in a way that can also be opened on Windows

Maybe it's a good Idea to create something like a cli interface to ask for sime important settings and than start the app. @dhyegofernando Are you in the mood to create a RP?

dhyegocalota commented 6 years ago

Unfortunately I can't for a while 😞

ghost commented 6 years ago

Hey, I’d like to jump in on this. Should this be implemented in care.js directly, or in another file?

ghost commented 6 years ago

Looking at the codebase a little more: a possible check for configuration would be to check if there aren’t any twitter keys, but TTC_APIKEYS is true (which it is by default).

Garbee commented 6 years ago

This would be it's own file. As @mojoaxel mentioned it would end up being a CLI front-end to help people get it configured.

Checking for config values is just pulling them from the node process environment. See if they exist, if not, ask for the user to provide them.

mojoaxel commented 6 years ago

@moriczgergo Maybe this helps: https://blog.kentcdodds.com/tips-for-making-a-cli-based-tool-with-node-9903255c2a3b

ghost commented 6 years ago

@mojoaxel Thanks :) I’ve made CLIs before, I’m just AFK at the moment.

ghost commented 6 years ago

ATM, I can’t even set up tiny-care-terminal on my machine. So, it’s gonna take a bit :)