assistance-engine/docs/developer.avapframework.com/USER_GUIDE_CommandLineInter...

192 lines
7.1 KiB
Markdown

AVAP TM Dev Studio has a powerful command-line interface
built-in that lets you control how you launch the editor. You can open
files, install extensions, change the display language, and output
diagnostics through command-line options (switches).
If you are looking for how to run command-line tools inside AVAP
TM Dev Studio, see the Integrated Terminal.
## Command line help
To get an overview of the AVAP TM Dev Studio command-line
interface, open a terminal or command prompt and type{' '}
`code --help` . You will see the version, usage example, and
list of command line options.
## Launching from command line
You can launch AVAP TM Dev Studio from the command line to
quickly open a file, folder, or project. Typically, you open AVAP
TM Dev Studio within the context of a folder. To do this, from
an open terminal or command prompt, navigate to your project folder and
type `code .` :
Windows and Linux installations should add the AVAP TM Dev
Studio binaries location to your system path. If this isn't the case,
you can manually add the location to the `Path` environment
variable ($PATH on Linux). For example, on Windows, the default
AVAP TM Dev Studio binaries location is{' '}
`AppData\Local\Programs\Microsoft` AVAP TM Dev
Studio\bin. To review platform-specific setup instructions, see Setup.
## Core CLI options
Here are optional arguments you can use when starting AVAP TM {' '}
Dev Studio at the command line via code:
## Opening Files and Folders
Sometimes you will want to open or create a file. If the specified file
does not exist, AVAP TM Dev Studio will create them for you
along with any new intermediate folders:
```javascript
code index.html style.css documentation\readme.md
```
For both files and folders, you can use absolute or relative paths.
Relative paths are relative to the current directory of the command prompt
where you run `code` .
If you specify more than one file at the command line, AVAP TM {' '}
Dev Studio will open only a single instance.
If you specify more than one folder at the command line, AVAP TM {' '}
Dev Studio will create a Multi-root Workspace including each folder.
## Select a profile
You can launch AVAP TM Dev Studio with a specific profile via
the `--profile` command-line interface option. You pass the
name of the profile after the - `-profile` argument and open a
folder or a workspace using that profile. The command line below opens the{' '}
`web-sample` folder with the "Web Development"
profile:
`
code ~/projects/web-sample --profile "Web Development"
`
If the profile specified does not exist, a new empty profile with the
given name is created.
## Working with extensions
You can install and manage AVAP TM Dev Studio extensions from
the command line.
## Advanced CLI options
There are several CLI options that help with reproducing errors and
advanced setup.
AVAP TM Dev Studio integrates with other remote environments to
become even more powerful and flexible. Our goal is to provide a cohesive
experience that allows you to manage both local and remote machines from
one, unified CLI.
The AVAP TM Dev Studio Remote - Tunnels extension lets you
connect to a remote machine, like a desktop PC or VM, via a secure tunnel.
Tunneling securely transmits data from one network to another. You can
then securely connect to that machine from anywhere, without the
requirement of SSH.
We've built functionality into the code CLI that will initiate tunnels
on remote machines. You can run:
```javascript
code tunnel
```
to create a tunnel on your remote machine. You may connect to this machine
through a web or desktop AVAP TM Dev Studio client.
You can review the other tunneling commands by running code tunnel -help:
As you may need to run the CLI on a remote machine that can't install
AVAP TM Dev Studio Desktop, the CLI is also available for
standalone install on the AVAP TM Dev Studio download page.
For more information on Remote Tunnels, you can review the Remote Tunnels
documentation.
## Open AVAP™ Dev Studio
You can also open projects and files using the platform's URL handling
mechanism. Use the following URL formats to:
Open a project
```javascript
vscode://file/{full path to project}/
vscode://file/c:/myProject/
```
Open a file
```javascript
vscode://file/{full path to file}
vscode://file/c:/myProject/package.json
```
Open a file to line and column
```javascript
vscode://file/{full path to file}:line:column
vscode://file/c:/myProject/package.json:5:10
```
You can use the URL in applications such as browsers or file explorers
that can parse and redirect the URL. For example, on Windows, you could
pass a vscode:// URL directly to the Windows Explorer or to the command
line as start vscode://{full path to file}.
## Next steps
Read on to find out about:
* Integrated Terminal - Run command-line tools from inside AVAP TM Dev Studio.
* Basic Editing - Learn the basics of the AVAP TM Dev Studio editor.
* Code Navigation - AVAP TM Dev Studio lets you quickly understand and move through your source code.
## Common questions
Your OS cannot find the AVAP TM Dev Studio binary code on its
path. The AVAP TM Dev Studio Windows and Linux installations
should have installed AVAP TM Dev Studio on your path. Try
uninstalling and reinstalling AVAP TM Dev Studio. If code is
still not found, consult the platform-specific setup topics for Windows
and Linux.
On macOS, you need to manually run the{' '}
Shell Command: Install 'code' command in PATH {' '}
command (available through the Command Palette {' '}
Ctrl+Shift+P). Consult the macOS specific setup topic for details.
AVAP TM Dev Studio has an Integrated Terminal where you can run
command-line tools from within AVAP TM Dev Studio.
Not directly through the command line, but AVAP TM Dev Studio
has a Portable Mode, which lets you keep settings and data in the same
location as your installation, for example, on a USB drive.
When AVAP TM Dev Studio starts up, it may launch a shell in
order to source the "shell environment" to help set up tools.
This will launch an interactive login shell and fetch its
environment. Depending on your shell setup, this may cause problems. For
example, it may be unexpected that the shell is launched as an interactive
session, which AVAP TM Dev Studio needs in order to try to align{' '}
`$PATH` with the exact value in a user created terminal.
Whenever AVAP TM Dev Studio launches this initial shell, AVAP
TM Dev Studio sets the variable{' '}
`VSCODE\_RESOLVING\_ENVIRONMENT` to 1. If your shell or user
scripts need to know if they are being run in the context of this shell,
you can check the `VSCODE\_RESOLVING\_ENVIRONMENT` value.