Giter Club home page Giter Club logo

bashfinder's People

Contributors

napoleonwils0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bashfinder's Issues

Library includes many unnecessary files, questionable Bash source, pollutes globals.

I was working on a fork but in the end I get what amounts to a new project tree, so I'll leave this with you. I strongly recommend adding the OSX_FINDER_FOCUS option like I show there, and also prefixing function names with __ (this is a convention you will see elsewhere). It also would be better if, like other small bash scripts, this one only included the important functions, and left it to the user to provide alias mappings to them.

__osx_win() {
    if [[ -z "$1" ]]; then
        local dir="$HOME"
    else
        local dir="$1"
    fi
    \cd "$dir" && __osx_open > /dev/null
}

__osx_open() { __osx_finder; }
__osx_column() { __osx_finder column; }
__osx_icon() { __osx_finder icon; }
__osx_list() { __osx_finder list; }

__osx_mirror() {
    cd "$(__osx_cwd)"
}

__osx_view() {
    __osx_finder "set the current view of the front Finder window to $1 view"
}

__osx_finder() {
    osascript -e 'set cwd to do shell script "pwd"' \
        -e 'tell application "Finder"' \
        -e 'if (1 <= (count Finder windows)) then' \
        -e 'set the target of window 1 to (POSIX file cwd) as string' \
        -e "$1" \
        -e 'else' \
        -e 'open (POSIX file cwd) as string' \
        -e "$1" \
        -e 'end if' -e 'end tell'
    if [[ "$?" && -n "$OSX_FINDER_FOCUS" ]]; then
        open -a Finder
    fi
}

__osx_cwd() {
    osascript -e 'tell application "Finder"' \
        -e 'if (1 <= (count Finder windows)) then' \
        -e 'get POSIX path of (target of window 1 as alias)' \
        -e 'else' \
        -e 'get POSIX path of (desktop as alias)' \
        -e 'end if' \
        -e 'end tell'
}

alias ee=__osx_open
alias cd=__osx_win
alias cdff=__osx_mirror
alias list=__osx_list
alias icon=__osx_icon
alias column=__osx_column

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.