Command-Line Interface: Syntax
Auto-Completion
Auto-completion is an optional feature that suggests SAS Viya CLI commands based on what the user has typed. When enabled, press the tab key to see possible matching commands. This should expedite coding and reduce errors. At present the suggestions are limited to commands, not to flags or options.
Auto-completion is supported for:
- Bash (version 4 or later)
- Zsh
- PowerShell (version 5 or later)
Enabling
The auto-completion module must be installed for your chosen shell.
For Bash, enter:
type complete
to check if the module is installed.
If the module is missing install it:
For Ubuntu/Debian enter:
sudo apt install bash-completion
For RHEL/CentOS enter:
sudo yum install bash-completion
For Zsh auto-completion is included by default.
For PowerShell, if auto-completion shows errors, these are the steps to try:
-
If
$PROFILEis not found:mkdir -p (Split-Path $PROFILE) -
If script execution is blocked:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -
If PSReadline module is not found:
Install-Module PSReadLine -Scope CurrentUser -Force
Issue the following command to enable auto-completion:
./sas-viya enable-completion --true
Restart the terminal to apply the changes.
Usage
Type a partial CLI command and press Tab.
For example, type: ./sas-viya au followed by Tab. The
result should complete the syntax to say:
./sas-viya auth.
Double click the Tab key to receive subcommand suggestions for the current command. For example,
./sas-viya <tab><tab>
generates a list of potential next commands. In this case:
profile prof authenicate auth authn curl... and so on.
Disabling
Disable auto-completion by typing:
./sas-viya enable-completion -f
Restart or reopen the shell to complete the process.
Did You Mean This?
The SAS Viya platform command-line interface (CLI) includes a feature that helps you when a command is entered incorrectly. This functionality is known as: Did you mean this?
If you enter a command that does not exist, the SAS Viya CLI analyzes your input and suggests similar valid commands. The intent is to help you quickly find the correct syntax and update your command.
The feature only activates when you enter an invalid command. The system compares your input with available commands and suggests those which are closest to the invalid entry.
For example, if you
type:./sas-viya ath, ath is not a
valid argument. The system returns the following:
Did you mean this?
auth, authn, authenticate
sas-viya: 'ath' is not a sas-viya comamnd.
See 'sas-viya --help' for more information.
Structure
The basic structure of a command-line interface (CLI) command is:
sas-viya
specifies the CLI.
[global options]
specifies options that are applicable to all plug-ins.
plug-in name
specifies a plug-in.
[command]
specifies a command that is specific for the plug-in that you are using.
[command options]
specifies options for the plug-in specific command that you are using.
[subcommand]
specifies a subcommand for the plug-in specific command that you are using.
[subcommand options]
specifies options for the subcommand.
[arguments]
specifies arguments for options.
For a list of plug-ins and links to examples, see Command-Line Interface: Plug-Ins.
Integrated Help
Global-Level Help
Use the integrated Help within the CLI to learn about the available global commands, plug-ins, and global options. The global options apply to each plug-in.
Example: List all the global commands, plug-ins, and global options for the CLI.
sas-viya help
Example: Show the version of the CLI.
sas-viya --version
Help for Plug-Ins
Use the integrated Help within the CLI to learn about the available commands, subcommands, and options for each plug-in. Use the same syntax for each plug-in, substituting the plug-in name or command that you are getting help for.
Example: List all the commands for the models plug-in.
sas-viya models --help
Example: List
the subcommands of the destination
command that is a part of the devices plug-in.
sas-viya models help destination
Example: List
the options of the create subcommand of
the destination command that is a part of
the models plug-in.
sas-viya models destination help create