Open Klion from the terminal

I am trying to set the path to the Clion directory on my computer to open this program using a command in the terminal, but it did not work.

If you read it and ask yourself: β€œwhat?”. I want to start a project in C ++, as with a regular text editor (I used to write codes with gedit).

I want something like, make a hello world:

Clion helloWorld.cpp & 

And he will open a new project called helloWorld, and then I can write the code.

If this is not possible, sorry.

+8
source share
3 answers

Examining this question, I just found that there is an officially supported way to do this using the CLion Tools|Create Command Line Launcher... menu item Tools|Create Command Line Launcher...

Full information is available here: https://www.jetbrains.com/help/clion/working-with-the-ide-features-from-command-line.html

+2
source

Launch CLion using the GUI, then launch Terminal and run the following to find which process is running:

 ps -ae| grep lion 

Output

 57257 ?? 0:20.45 /Applications/CLion.app/Contents/MacOS/clion 57434 ttys000 0:00.00 grep lion 

So, I need a command, which in my case to run CLION from the command line:

 /Applications/CLion.app/Contents/MacOS/clion 

Then you need to pass the directory containing your project so that you can make this function:

 function CLion { /Applications/CLion.app/Contents/MacOS/clion "$1"; } 

Then you can simply enter:

 Clion ~/CLionProjects/someProject 
+7
source

If you use the JetBrains Toolbox to manage your CLion applications (or other IntelliJ) like me, you will find that Toolbox installs CLion with a versioned path. This means that every time you update CLion , the path to clion.sh starts clion.sh .

For Linux environments, you can use the following in your ~/.bash_profile to solve this ~/.bash_profile :

 alias clion="'find ~/.local -iname clion.sh | head -1' >/dev/null &" #Linux 

or

 alias clion=open -n "$(IFS=$'\n' && find "${HOME}/Library/Application Support/JetBrains/Toolbox/apps/CLion" -iname clion.app | head -1)" #Mac OS X 

If you upgrade your CLion you can restart your terminal or just start . ~/.bashrc . ~/.bashrc . ~/.bashrc . ~/.bashrc to update the clion alias.

0
source

Source: https://habr.com/ru/post/1262354/


All Articles