Code Monkey home page Code Monkey logo

switcher's Introduction

NAME
    switcher

SYNOPSIS
    switcher command [options]

DESCRIPTION
    This is Ruby script for dealing with multiple version as the same binary name.
    Like rvm, but you can define group by yourself.

COMMANDS
    list [group]
        You can watch the group information. (what version does each group have?)
        If you specify group, you can watch versions in specific group.

    use {group} {version}
        Switcher sets PATH to {version} of {group}.
        If you specify system for {version}, switcher use system default setting.

    current
        Switcher show what version of group is currently using.

    reset
        Switcher sets all versions to system.

EXAMPLE
    example setting:

        groupname: ruby
        * version: 1.8.7
        ruby => /usr/bin/ruby
        rdoc => /usr/bin/rdoc
        rake => /usr/bin/rake
        irb  => /usr/bin/irb
        ri   => /usr/bin/ri
        gem  => /usr/bin/gem

        * version: 1.9.3
        ruby => /usr/local/bin/ruby
        rdoc => /usr/local/bin/rdoc
        rake => /usr/local/bin/rake
        irb  => /usr/local/bin/irb
        ri   => /usr/local/bin/ri
        gem  => /usr/local/bin/gem

    example commands:

        % switcher list
        => displays above list

        % switcher use ruby 1.9.3
        => paths of ruby,rdoc,rake,irb,ri,gem set to binary for Ruby 1.9.3.

        % switcher current
        => show version. (for example, 1.9.3)

BOOTSTRAP
    You must set and define some information manually.

    1. put switcher to anywhere in your path.

    2. edit source code of switcher

        2-1. At first, you define $switcher_path at line 4. (default is /usr/local/bin. and setting for $HOME is commentouted)

        2-2. Secondly, you define groups and versions of them.
             There are gcc group and Ruby group for example.
             And snippet of definition of group is commentouted.

    3. set path of "${switcher_path}/switcher.d" to head of $PATH.
       write to your .bashrc / .zshrc like below.
       
            export PATH=/usr/local/bin/switcher.d:$PATH (this is example: $switcher_path = /usr/local/bin)

    4. you've finished needed settings. But you must recreate hash of shell after
       you change to another version of group with use command.
            
            % rehash  (in zsh)
            % hash -r (in bash)

       If you recreate hash automatically, set below.

        4-1. for bash
            You use switcher.sh instead of switcher.

        4-2. for zsh
            You write below setting to .zshrc

            # switcher setting
            function switcher(){
                /path/to/switcher $*
                if [ "$1" = "use" ]; then
                    echo "rehash shell database"
                    rehash
                fi
            }

AUTHOR
    rhysd (https://github.com/rhysd)

switcher's People

Watchers

 avatar  avatar  avatar

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.