terriann / dotfiles

Terri's MacOS configuration files
MIT License
0 stars 0 forks source link

Make Sublime alias smarter #1

Closed terriann closed 7 years ago

terriann commented 7 years ago

The Sublime alias is pretty simple right now: alias sublime="open -a Sublime\ Text"

I'd like to make it a bash script with prompts and some smarter logic to help open project files instead of the directory.

Open Project by default

If I run sublime without any parameters and there is one *.sublime-project file in the current working directory, Sublime text should open that project.

Prompt if more than one project present

If I run sublime without any parameters and there is more than one *.sublime-project file in the current working directory, Sublime text should prompt and ask which project to open. Up and down keys should select the options.

Which project would you like to open? > project-1.sublime-project project-2.sublime-project

Double Check With Params

If the directory is open with the parameter . but there is one or more *.sublime-project files in the directory it should prompt the user with the following prompt

There are project file(s) present, are you sure you want to open the directory? (Y/n)

If yes (default), continue.

If no, go the path of open project by default/prompt if more than one project present, as outlined above.

Resource Links

https://www.cyberciti.biz/tips/find-out-if-file-exists-with-conditional-expressions.html https://stackoverflow.com/questions/226703/how-do-i-prompt-for-yes-no-cancel-input-in-a-linux-shell-script

terriann commented 7 years ago

Updated to won't fix; I'm moving away from Sublime in lieu of Visual Studio Code.