I've installed Sublime 3 and I want to be able to launch cmd commands in the console, e.g "npm show express version".
How can I make this possible?
I've installed Sublime 3 and I want to be able to launch cmd commands in the console, e.g "npm show express version".
How can I make this possible?
As far as I know there is no sublime api method for this, but as sublime console is a Python console this could also be a Python question, so you can see many related question in stackoverflow (related question 1, related question 2, many others...).
Example based on part 3 of this answer executed in sublime:
import subprocess
print(subprocess.Popen("npm show express version", shell=True, stdout=subprocess.PIPE).stdout.read())
Output:
b'4.13.0\n\n'
Look at the new-line character (\n) in the output. You'll have to find the method that is better for your needs. Some methods read line by line, others block until the process has finished, others calls a command and return the output code, etc...
Also in Package Control you can search for packages containing (for example) shell as some of them claim to run shell command (I haven't installed them).