GithubHelp home page GithubHelp logo

dsimidzija / golang-goto Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.25 MB

Console app which manages folder bookmarks for frequently visited places in terminal.

License: GNU General Public License v3.0

Makefile 6.90% Go 93.10%

golang-goto's Introduction

GOLANG GOTO

A small experimental project inspired by iridakos/goto and pass, but much less useful because it offers only the basic functionality. It was created because I wanted to try out golang, and nothing else. To use it, just do the standard $GOPATH magic, and then use the Makefile to build/install.

Unfortunately it is not possible to change the working dir of a parent shell from an app, so a bash function of some sort is always needed to wrap the actual executable. For example, if you want to use the alias g for faster jumping around, you need to add the following to your ~/.bashrc:

function g() {
    _OUTPUT=$(goto --signal 5 "$@")

    if [ $? -eq 5 ]; then
        cd "${_OUTPUT}"
    else
        printf "${_OUTPUT}\n"
    fi
}

Now you should be able to use this:

$ g -h
Jump to specified dir alias

Usage:
  goto <alias> [flags]
  goto [command]

Available Commands:
  add         Add a new goto alias
  help        Help about any command
  init        Initialize a goto repository
  ls          List dir aliases

Flags:
  -h, --help   help for goto

Use "goto [command] --help" for more information about a command.

$ g init
Initialized new goto repo at /home/yourusername/.goto

$ g add vim ~/.vim/bundle
Added: vim => /home/yourusername/.vim/bundle

$ g ls
/home/yourusername/.goto
└── vim

$ g vim
# will actually cd into ~/.vim/bundle

Just like pass, you can init multiple goto "repos", but that's usually not necessary. The idea can be extended further but I'm disappointed in how golang works and feels, so this will probably be abandoned until further notice.

Some of the projects used for snooping around golang syntax:

golang-goto's People

Contributors

dsimidzija avatar

Watchers

 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.