1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Use a Zsh Function With AppleScript to Get the URL From Chrome

    AppleScript is a powerful and strange language that allows you to interact with apps in a wide variety of ways. One feature it enables is the ability to get the URL from Chrome so that you can take the URL and do whatever you want with it.

    zshclone(){
      cd ~/projects
      url=$(osascript -e 'tell application "Google Chrome" to return URL of active tab of front window')
    
      repo=${url:19}
      name=${repo:t}
    
      git clone git@github.com:$repo && code $name
    }