tiny-care-terminal icon indicating copy to clipboard operation
tiny-care-terminal copied to clipboard

Startup helper

Open dhyegocalota opened this issue 7 years ago • 13 comments

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 :)

dhyegocalota avatar Jun 08 '17 16:06 dhyegocalota

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

egordorichev avatar Jun 08 '17 16:06 egordorichev

@egordorichev exactly, that's the purporse

dhyegocalota avatar Jun 08 '17 17:06 dhyegocalota

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

egordorichev avatar Jun 08 '17 17:06 egordorichev

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

dhyegocalota avatar Jun 08 '17 17:06 dhyegocalota

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.

Garbee avatar Jun 08 '17 17:06 Garbee

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?

mojoaxel avatar Mar 14 '18 19:03 mojoaxel

Unfortunately I can't for a while 😞

dhyegocalota avatar Mar 14 '18 21:03 dhyegocalota

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

ghost avatar May 21 '18 21:05 ghost

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).

ghost avatar May 21 '18 21:05 ghost

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.

Garbee avatar May 21 '18 21:05 Garbee

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

mojoaxel avatar May 22 '18 06:05 mojoaxel

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

ghost avatar May 22 '18 06:05 ghost

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

ghost avatar May 23 '18 19:05 ghost