简体   繁体   中英

How do you access the command line in Dart Pub package manager

I am trying to explore using Dart's Pub package manager on the command line. Unfortunately, I don't know how to do this, and all the documentation I have read, presupposes that this is known. What are the actual steps needed to set up the command line, so you can run pub commands on GNU/Linux systems?

This is an expansion on this question: link . Can someone please help?

You can either add the dart-sdk/bin directory to the path or create symlinks in /usr/bin for the command line tools you want to have available. You can of course just use the full path to the executables.

If you're on Linux and you've unpackaged the SDK in /home/$USER/ you should add the SDK PATH to the bottom of your .bashrc .

vim ~/.bashrc

 DART_SDK=/home/${USER}/dart/dart-sdk
 export PATH=${PATH}:${DART_SDK}/bin
 alias DartEditor='/home/${USER}/dart/DartEditor'
 alias dartium='/home/${USER}/dart/chromium/chrome'

You might have to run source ~/.bashrc to have the binaries available in your current console.

Now you should be able to run pub --help and work your way from there. Also you can now open the editor and the dart based chrome from the commandline like this: DartEditor or dartium (add & exit to those command if you don't want the output from those programs).

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM