GithubHelp home page GithubHelp logo

go-tool's Introduction

go -- quick directory switching
===============================

Download the latest go packages from here:
    (archive) http://go-tool.googlecode.com/files/go-1.2.1.zip


Home            : http://trentm.com/projects/go/
License         : MIT (see LICENSE.txt)
Platforms       : Windows, Linux, Mac OS X, Unix
Current Version : 1.2.1
Dev Status      : mature
Requirements    : Python >= 2.4 (http://www.activestate.com/ActivePython/)


What's new?
-----------

I have moved hosting of `go.py` from my [personal
pages](http://trentm.com/projects/) to the [go-tool Google Code
project](http://code.google.com/p/go-tool/).  See the [Change
Log](#changelog) below for more.


Why go?
-------

`go` is a small command for changing directories quickly.
Typically you have a set of directories that you work in.  Typing out
the names of those dirs in full can be tedious.  `go` allows you to
give a shortcut name for a directory, say `ko` for
`D:\trentm\main\Apps\Komodo-devel`, and do the following:

    C:\> go ko
    D:\trentm\main\Apps\Komodo-devel>

and

    C:\> go ko/test
    D:\trentm\main\Apps\Komodo-devel\test>

Think of it as a super `cd`. 

`go` is free (MIT License).  Please send any feedback to [Trent
Mick](mailto:trentm@google's mail thing).


Install Notes
-------------

Download the latest (1) `go` source package, (2) unzip it, (3) run
`python setup.py install` in the unzipped directory, and (4) run
`python -m go` to setup the shell driver:

    unzip go-1.2.1.zip
    cd go-1.2.1
    python setup.py install
    python -m go   # to setup shell integration



Getting Started
---------------

The most common things you'll do with `go` are adding new shortcuts:

    [~/Library/Application Support/Komodo]$ go -a koappdata

listing the shortcuts you've created:

    [~]$ go --list
                        Go Shortcuts
                        ============

    Default shortcuts:
      .                     .
      ..                    ..
      ...                   ../..
      tmp                   /tmp
      ~                     /Users/trentm

    Custom shortcuts:
      cgi-bin               /Library/WebServer/CGI-Executables
      koappdata             /Users/trentm/Library/Application Support/Komodo
      pyinstall             /Library/Frameworks/Python.framework/Versions/2.6
      staging               /Users/trentm/Sites/staging
      www                   /Users/trentm/Sites

and switching to directories using those shortcuts:

    [~]$ go pyinstall
    [/Library/Frameworks/Python.framework/Versions/2.6]$ go www
    [~/Sites]$ 

Run `go --help` for full usage details or just [take a look at the
`go.py` script](go.py):

    $ go --help
    Quick directory changing.

    Usage:
        go <shortcut>[/sub/dir/path]    # change directories
                                        # same as "go -c ..."
        go -c|-o|-a|-d|-s ...           # cd, open, add, delete, set
        go --list [<pattern>]           # list matching shortcuts

    Options:
        -h, --help                      print this help and exit
        -V, --version                   print verion info and exit

        -c, --cd <path>                 cd to shortcut path in shell
        -s, --set <shortcut> <dir>      set a shortcut to <dir>
        -a, --add-current <shortcut>    add shortcut to current directory
        -d, --delete <shortcut>         delete the named shortcut
        -o, --open <path>               open the given shortcut path in
                                        explorer (Windows only)
        -l, --list [<pattern>]          list current shortcuts

    Generally you have a set of directories that you commonly visit.
    Typing these paths in full can be a pain. This script allows one to
    define a set of directory shortcuts to be able to quickly change to
    them. For example, I could define 'ko' to represent
    "D:\trentm\main\Apps\Komodo-devel", then
        C:\> go ko
        D:\trentm\main\Apps\Komodo-devel>
    and
        C:\> go ko/test
        D:\trentm\main\Apps\Komodo-devel\test>

    As well, you can always use some standard shortcuts, such as '~'
    (home) and '...' (up two dirs).

    See <http://trentm.com/projects/go/> for more information.


Change Log
----------

### v1.2.1
- Fix the helper command line "setup" code to work with Python 2.4.

### v1.2.0
- Add support for "go FOO" falling back to changing to subdirectory
  "FOO" if there is no "FOO" shortcut. Patch from Phil Schwartz.

### v1.1.0
- Move to 'go-tool' Google Code project. (Couldn't use "go" because
  Google Code requires minimum 4 (or 3?) characters for a project
  name.)
- Add automatic setup code to assist with setting up the shell
  integration drivers.

### v1.0.6
- Redo changes to 'function go' that were made in version 1.0.4 so
  that people without my own personal Bash definitions can actually
  use it.

### v1.0.5
- Fix bug where 'go' would fail to switch to a directory with spaces.

### v1.0.4
- Improve Bash 'function go' to fail more gracefully if 'go' is
  not found on the PATH.

### v1.0.3
- Correct information about the suggested Bash "go" function
  definition to avoid a user's possible "which" alias (some RedHat
  systems setup "alias which='type -p'") that can screw things up.

### v1.0.2
- Filter out the stupid FCNTL.py deprecation warning for usage with
  Python 2.3 on Windows.

### v1.0.1
- Ensure the installed 'go' script on non-Windows is executable.

### v1.0.0
- Change version attributes and semantics. Before: had a _version_
  tuple. After: __version__ is a string, __version_info__ is a tuple.

### v0.9.2:
- Fix install on Un*x: 'go' script wasn't in sdist to install

### v0.9.1:
- Find gow.cpp again and get gow.exe into dists to fix installation and
  DQSD integration on Windows.

### v0.9.0:
- Move hosting to trentm.com.
- Improve starter docs a little bit.

### v0.8.2:
- Ensure that "go SHORTCUT" switches to the correct drive on
  Windows when called in a subsystem:window environment (via the /D
  switch).
- Drop the '-o' option added by the DQSD go.xml search. This means
  that openning the given path in the _shell_ is now the default, as
  it is for command line usage.

### v0.8.1:
- Remove a debugging statement in 0.8.0 that caused "go SHORTCUT"
  to fail from Dave's Quick Search Deskbar.
- Install go.py as 'go' in Linux, which executable bit set. Before
  this, getting go going was a real pain. It still is somewhat.

### v0.8.0:
- Improve Windows integration: errors are now shown in dialogs rather
  than lost on the non-existant console.
- Improve DQSD integration. The default action is not to open a shell
  to the stated directory. "go -o" can be used, as on the command
  line, to open a directory in Explorer.
- Fix bug introduced in 0.7.0 whereby using go's innocuous options
  (-h, -V) could result in a directory change from the last "go"
  call.
- Add explicit "-c" option for the default "change directories"
  action.
- Improve shortcut listing output.

### v0.7.0:
- Add an optional argument when listing (-l|--list) to be a pattern
  for existing shortcuts, e.g.:
      go -l foo  # lists all shortcuts with foo in them
- Add DQSD (Dave's Quick Search Deskbar) integration. After
  installation and a re-start of DQSD you should be able to jump to
  directory shortcuts via "go SHORTCUT[/SUBPATH]" in DQSD.

### v0.6.3:
- first public release

go-tool's People

Watchers

 avatar

go-tool's Issues

/usr/bin/python: No module named go

What steps will reproduce the problem?
1. Update to Mac Os Lion
2. Run any go command


What is the expected output? What do you see instead?
I see the error in the subject line instead of the correct behavior.

What version of the product are you using? On what operating system?
Latest version as of today. OS is Mac Os X Lion.


Original issue reported on code.google.com by [email protected] on 31 Jul 2011 at 10:51

Can't handle non-ascii folder names

What steps will reproduce the problem?
1. create a directory named vidéos
2. cd vidéos
3. go -a vids

What is the expected output? What do you see instead?

Should add a shortcut but instead I get the following exception traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.6/dist-packages/go.py", line 765, in <module>
    retval = main(sys.argv)
  File "/usr/local/lib/python2.6/dist-packages/go.py", line 649, in main
    setShortcut(name, value)
  File "/usr/local/lib/python2.6/dist-packages/go.py", line 195, in setShortcut
    fout.write(dom.toxml())
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 45, in toxml
    return self.toprettyxml("", "", encoding)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 60, in toprettyxml
    return writer.getvalue()
  File "/usr/lib/python2.6/StringIO.py", line 270, in getvalue
    self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18:
ordinal not in range(128)


What version of the product are you using? On what operating system?

1.2.1 on Ubuntu 9.10 and Python 2.6.4

Original issue reported on code.google.com by [email protected] on 29 Apr 2010 at 8:44

Shell integration with oh-my-zsh not working

What steps will reproduce the problem?
1. python -m go does not work on Mac OSX 10.6 with oh-my-zsh

What is the expected output? What do you see instead?
python -m go                                                                    
                               [ruby-1.9.2-p290] 
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 121, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/Library/Python/2.6/site-packages/go.py", line 765, in <module>
    retval = main(sys.argv)
  File "/Library/Python/2.6/site-packages/go.py", line 601, in main
    return setup()
  File "/Library/Python/2.6/site-packages/go.py", line 379, in setup
    % shell)
__main__.InternalGoError: don't know how to setup for your shell: None

* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Please log a bug at                                 *
*    http://code.google.com/p/go-tool/issues/list     *
* to report this error. Thanks!                       *
* -- Trent                                            *
* * * * * * * * * * * * * * * * * * * * * * * * * * * *



What version of the product are you using? On what operating system?
go-1.2.1

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 6 Apr 2012 at 2:22

Support for ZSH

Go does not seem to recognise ZSH as a shell.

To work around this, I had to change:

    $ vim /usr/lib/python2.6/site-packages/go.py

    363         if "/bash" in shell_path or "/sh" in shell_path or shell_path == 'zsh':

Running:

    $ python -m go

then prompted me to paste the function in my ~/.bashrc file, but ZSH uses  
~/.zshrc instead. Simply appending the function to the bottom of the file did 
the trick.

Original issue reported on code.google.com by [email protected] on 23 Jul 2010 at 9:42

Another case where installing Python 3.* screws up 2.6/go

I had two Python's installed: 2.5.1, and 2.6, 2.6 is the one in the path.
go was installed in 2.6

I downloaded ActivePython 3.1.0.1

Now typing 'go ko' moves to the Komodo directory, but
also launches my dev build of Komodo -- `which ko' returns nothing

Typing 'go -l' launches an alert box that says
<<unknown option '-l', aborting>>

Putting in 'pause' statements in go.bat shows that this is happening
inside go.py, not inside go.bat or the generated $TEMP/__tmp_go.bat

Congratulations, by the way =)

Original issue reported on code.google.com by [email protected] on 7 Jul 2009 at 8:58

Running python v3, then returning to v2, ruins the go install

1. I installed go for Python 2.6

2. Install Python 3.0

3. Install go for Python 3.0

4. Use go with Python 3.0 in the path

5. Get fed up with Python 3.0, move back to 2.6
as my default Python

6. Uses of 'go ....' now complain about Python 2.6-style
except statements (e.g. ... except TypeError, ex)

Workaround: uninstall go/2.6 and reinstall


Original issue reported on code.google.com by [email protected] on 23 May 2009 at 12:37

go function in .profile on Ubuntu breaks X11 login

What steps will reproduce the problem?
1. install go
2. add go function to .profile instead of .bashrc
3. log out of X11 session, then back in

What is the expected output? What do you see instead?

This was logged in .xsession-errors:

/home/jeffg/.profile: 35: function: not found
go: error: Unrecognized shortcut: ''gnome-session''
/home/jeffg/.profile: 40: source: not found
/home/jeffg/.profile: 42: Syntax error: "}" unexpected

The problem is .profile is loaded in /bin/sh, not bash, so the bash
function syntax isn't supported. 

What version of the product are you using? On what operating system?

latest svn on Ubuntu 9.10




Original issue reported on code.google.com by anisotropic on 22 Oct 2009 at 5:05

go -

I realized that typing "go subdir/" actually acts like "cd subdir/" if 
there is not any alias named "subdir".

Although "go -" does not work like "cd -".

Maybe this little feature would be nice (when you want to train your 
fingers to type "go" instead of "cd").


Original issue reported on code.google.com by [email protected] on 29 Sep 2009 at 5:16

Added support for action --open on Mac OS X

I found out about go-tool through Komodo Edit and noticed it only supports 
--open option on Windows so I decided to help and add support for Mac OS X.

Just modified a few lines and it's done. =)

https://github.com/PChambino/go-tool/commit/c0c286493a0ef76362bd8bab1a634c40f2f9
e9d5

Original issue reported on code.google.com by pchambino on 26 Jul 2011 at 12:59

doesn't work on centos6

Guys,

1. installed python 2.7 in addition to python 2.6 (needed by YUM on centos)
2. installed go with pip

[root@~]# pip-2.7 install go

Downloading/unpacking go
  Downloading go-1.2.1.zip
  Running setup.py egg_info for package go

Installing collected packages: go
  Running setup.py install for go

Successfully installed go
Cleaning up...

3. then
[root@~]# go --h
-bash: go: command not found

any ideas?

thanks,
Dmitry

Original issue reported on code.google.com by [email protected] on 3 Jul 2013 at 6:46

Python traceback when switching *from* a non-existing directory

sridharr@triple:/tmp/nonexisting$ rm -rf /tmp/nonexisting/
sridharr@triple:/tmp/nonexisting$ go nightly
Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 104, in _run_module_as_main
    loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib/python2.6/runpy.py", line 79, in _get_module_details
    loader = get_loader(mod_name)
  File "/usr/lib/python2.6/pkgutil.py", line 456, in get_loader
    return find_loader(fullname)
  File "/usr/lib/python2.6/pkgutil.py", line 467, in find_loader
    loader = importer.find_module(fullname)
  File "/usr/lib/python2.6/pkgutil.py", line 184, in find_module
    path = [os.path.realpath(self.path)]
  File "/usr/lib/python2.6/posixpath.py", line 365, in realpath
    return abspath(filename)
  File "/usr/lib/python2.6/posixpath.py", line 338, in abspath
    path = join(os.getcwd(), path)
OSError: [Errno 2] No such file or directory
sridharr@triple:~/as/apy/branches/nightly$

Original issue reported on code.google.com by [email protected] on 18 Dec 2009 at 10:10

feature request: add auto-completion capability

A nice feature to add would be the ability for go to autocomplete the shortcut 
name so that if you have a shortcut named g1 and another named g2 you can hit 
tab after typing "go g" and have it prompt with "g1 g2".

Similarly, you could extend the auto-completion beyond the shortcut name once a 
/ has been typed so that you can autocomplete the subfolder name. An example 
voudl be a shortcut name (say) "vcs" with subfolders (say) "services", "bs" and 
"signal". When the user types "go vcs/" and then hits TAB the autocomplete 
kicks in and show the names of relevant folders. In this case it would hint 
with "bs services signal". Naturally, this feature is only useful if the 
completion goes all the way down the file tree for that hitting TAB after 
typing "go vcs/a/b/c/d/e/f/" does autocompletion for folders in the f folder.

Original issue reported on code.google.com by [email protected] on 28 Jul 2010 at 3:16

go.bat not installed

What steps will reproduce the problem?
Either "python setup.py install" or "pip install go".

go is installed successfully in both cases, but isn't ready to go from the
command line. And go.bat isn't in the zip file.

What version of the product are you using? On what operating system?
go-1.2.1.zip on Win2k.

Original issue reported on code.google.com by [email protected] on 17 Sep 2009 at 8:52

"go <name>" is broken on PowerShell

This happens on Windows 7's PowerShell[1]:

[pypm] C:\Users\sridharr\as\pypm>go tmp
[pypm] C:\Users\sridharr\as\pypm>go ...
[pypm] C:\Users\sridharr\as\pypm>go ..
[pypm] C:\Users\sridharr\as\pypm>go .
[pypm] C:\Users\sridharr\as\pypm>

As you can see, nothing happens (i.e., directory is not changed) when you 
use go in PowerShell.

I should be able to help with this, if you want.

***
[1] http://en.wikipedia.org/wiki/Windows_PowerShell

Original issue reported on code.google.com by [email protected] on 19 Nov 2009 at 6:10

Feature Request: go option for automating bash completion list of users shortcuts

#!/usr/bin/env ruby -w

# PURPOSE:
#  The go (version 1.2.1) command without bash command-line completion for your 
shortcuts is like a hammer without nails.
#  Unfortunately the go (version 1.2.1) command uses an XML string for the 
'human interface' configuration file.

# IMPORTANT FOLLOW-UP STEP:
#  Add the following line to ~/.bashrc after executing this file 
(go_bash_completion_list.rb) :
#  complete -W "`cat 
/Users/pcs/Projects/Ruby/go_completion/go_bash_completion_list.txt`" go

# SEE ALSO:
#  Run 'man autojump'  and  run 'cdargs --help'. 

dd = "/Users/pcs/Projects/Ruby/go_completion/" # development directory
inputfn = '/Users/pcs/.go/shortcuts.xml'       # input filename 
outputfn = "go_bash_completion_list.txt"       # output filename

# Move old bash completion list for go command into MacOSX Trash folder for 
later dumpster-diving if necessary. 
system("/opt/local/bin/rmtrash #{dd}#{outputfn}") if 
File.exists?("#{dd}#{outputfn}") 

infh = File.new("#{inputfn}", File::RDONLY) # File handle object for reading 
only.
outfh = File.new("#{dd}#{outputfn}", "a+")  # File handle object for appending 
and reading.

infh.each do |line|
  name_list = line.scan(/name="(\w+)"/)
  name_list.each do |ary|
    matchdata = /\[\"(\w+)\"\]/.match("#{ary}")
    outfh.print "#{matchdata[1]} "
  end
end

outfh.rewind
outfh.each {|line| puts line} # Display completion list for eyeballs. 

infh.close
outfh.close


Original issue reported on code.google.com by [email protected] on 20 Mar 2012 at 6:27

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.