/fs-tool

A legendary command-line tool whose kung fu skills were the stuff of legend.

Primary LanguageShellMIT LicenseMIT

fs Build Status

A legendary command-line tool whose kung fu skills were the stuff of legend.

Installation

The best way to get fs-tool is via Homebrew.

Homebrew

brew tap fs/fstool
brew install fs-tool

Or install via URL:

brew install https://raw.github.com/fs/homebrew-fstool/master/fs-tool.rb

And then follow the instructions in caveats section.

Manual

git clone git@github.com:fs/fs-tool.git ~/.fs-tool

Bash users:

echo 'eval "$($HOME/.fs-tool/bin/fs init -)"' >> ~/.bash_profile
exec bash

Zsh users:

echo 'eval "$($HOME/.fs-tool/bin/fs init -)"' >> ~/.zshenv
source ~/.zshenv

Commands

Run fs without any arguments or run fs help to explore available commands. fs help <command_name> prints usage and other command documentation.

fs wisdom (fs wise)

Shares the best wisdom quotes and our core values with you.

$ fs wisdom
Great Work is a Matter of Pride

PRO tip: You can add this command to your .zlogin file via echo "fs wisdom" > ~/.zlogin and get all the awesome quotes on your shell's startup.

fs gh

Open current github repo in browser

$ fs gh                              # opens current repo on github
$ fs gh p                            # opens current Pull Request (or "Create Pull Request" page)
$ fs gh pulls                        # opens current repo's pull requests on github
$ fs gh issues (fs gh i)             # opens current repo's issues on github
$ fs gh issues new (fs gh i n)       # opens new issue in current repo on github
$ fs gh pulls closed (fs gh pulls c) # opens current repo's closed pull requests on github
$ fs gh issues closed (fs gh i c)    # opens current repo's closed issues on github
$ fs gh search (fs gh s) <query>     # searches in current repo
$ fs gh show <commit_id>             # opens commit <commit_id> on github

PRO tip: You can add an alias for the rockstar fs gh p command:

alias pr='fs gh p'

fs ci

Open branch's CI page in browser

$ fs ci            # opens current branch on CI service
$ fs ci master     # opens "master" branch on CI service

PRO tip: Another killer feature here:

alias ci='fs ci'

fs new (fs bootstrap)

Bootstrap new project from fs/xxx-base templates

$ fs new rails <project name>  # setup new project using rails-base template
$ fs new api <project name>    # setup new project using rails-base-api template
$ fs new static <project name> # setup new project using static-base template

fs h (fs guide)

Open corresponding guides' section in browser. If section is not found then search through the guides.

$ fs h style                     # opens "Style Guide"
$ fs h code review               # opens "Code Review"
$ fs h heroku                    # opens "Deploy to Heroku"
$ fs h new project               # opens "Create new project from scratch"
$ fs h I am no longer young      # searches "I am no longer young" in the guides

See available sections in command autocompletion:

$ fs h <TAB><TAB>
aws               dns               logentries        openspace_rules   semaphore
basecamp          github            maintain          pagerduty         style
bug_report        google_apps       maintain_project  passpack          style_guide
bug_reports       heroku            network           pingdom           workflow
code_review       hipchat           new_project       printer
communicate       infrastructure    open_space_rules  printers
communication     learn             openspace         rollbar

Remote commands

Remote commands use per-user or per-project server configuration stored in .fs.yml, for example:

# .fs.yml
servers:
 defaults: &defaults
   address: me@startup-s1.com
   environment: staging
   root: /data/application
 staging:
   <<: *defaults
 production:
   <<: *defaults
   address: me@startup.com

Global configuration:

# ~/.fs.yml
servers:
  home:
    address: foo@stark.geocities.com
    environment: staging
    root: /var/www/stark

fs init-config (fs ic)

Creates an example .fs.yml config file in a current project directory or in home directory.

fs init-config            # create .fs.yml in a current directory
fs init-config --global   # create .fs.yml in home directory

fs console (fs c)

Run remote Rails console attached to a given application (environment).

$ fs c staging         # opens SSH session to me@startup-s1.com and runs `rails c` in app root
$ fs c production      # opens SSH session to me@startup.com and runs `rails c` in app root
$ fs c home            # opens SSH session foo@stark.geocities.com and runs `rails c` in app root
$ fs c                 # runs `bundle exec rails c` in the current directory

fs tail

Display the recent application logs in realtime.

$ fs tail staging         # opens SSH session to me@startup-s1.com and tails application log
$ fs tail staging dj.log  # opens SSH session to me@startup-s1.com and tails dj.log
$ fs tail production      # opens SSH session to me@startup.com and tails application log
$ fs tail home            # opens SSH session foo@stark.geocities.com and tails application log
$ fs tail                 # runs `tail -f log/*.log` in the current directory

fs grep

Search in the application logs.

$ fs grep staging foo     # opens SSH session to me@startup-s1.com and greps 'foo' in application log
$ fs grep production bar  # opens SSH session to me@startup.com and greps 'bar' in application log
$ fs grep home baz        # opens SSH session foo@stark.geocities.com and greps 'baz' in application log
$ fs grep happiness       # greps 'happiness' in log/development.log

fs ssh

Open SSH session to a given application (environment).

$ fs ssh staging         # opens SSH session to me@startup-s1.com
$ fs ssh production      # opens SSH session to me@startup.com
$ fs ssh home            # opens SSH session foo@stark.geocities.com

Credits

FS Tools is maintained by Vasily Polovnyov. It was written by Flatstack with the help of our contributors.