Skip to content

Commit

Permalink
Merge pull request #2877 from balena-io/devices-support-to-device-typ…
Browse files Browse the repository at this point in the history
…e-list

Add alias `device-type list` for command `devices supported`
  • Loading branch information
myarmolinsky authored Oct 23, 2024
2 parents f305d5d + 8655b89 commit f52e218
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 114 deletions.
10 changes: 5 additions & 5 deletions completion/_balena
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ _balena() {
local context state line curcontext="$curcontext"

# Valid top-level completions
main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami )
main_commands=( api-key app block build config deploy device device-type env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami )
# Sub-completions
api_key_cmds=( generate list revoke )
app_cmds=( create )
block_cmds=( create )
config_cmds=( generate inject read reconfigure write )
device_type_cmds=( list )
device_cmds=( deactivate detect identify init list local-mode logs move note os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel )
devices_cmds=( supported )
env_cmds=( list rename rm set )
fleet_cmds=( create list pin purge rename restart rm track-latest )
internal_cmds=( osinit )
Expand Down Expand Up @@ -55,12 +55,12 @@ _balena_sec_cmds() {
"config")
_describe -t config_cmds 'config_cmd' config_cmds "$@" && ret=0
;;
"device-type")
_describe -t device_type_cmds 'device-type_cmd' device_type_cmds "$@" && ret=0
;;
"device")
_describe -t device_cmds 'device_cmd' device_cmds "$@" && ret=0
;;
"devices")
_describe -t devices_cmds 'devices_cmd' devices_cmds "$@" && ret=0
;;
"env")
_describe -t env_cmds 'env_cmd' env_cmds "$@" && ret=0
;;
Expand Down
10 changes: 5 additions & 5 deletions completion/balena-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ _balena_complete()
local cur prev

# Valid top-level completions
main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami"
main_commands="api-key app block build config deploy device device-type env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami"
# Sub-completions
api_key_cmds="generate list revoke"
app_cmds="create"
block_cmds="create"
config_cmds="generate inject read reconfigure write"
device_type_cmds="list"
device_cmds="deactivate detect identify init list local-mode logs move note os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel"
devices_cmds="supported"
env_cmds="list rename rm set"
fleet_cmds="create list pin purge rename restart rm track-latest"
internal_cmds="osinit"
Expand Down Expand Up @@ -49,12 +49,12 @@ _balena_complete()
config)
COMPREPLY=( $(compgen -W "$config_cmds" -- $cur) )
;;
device-type)
COMPREPLY=( $(compgen -W "$device_type_cmds" -- $cur) )
;;
device)
COMPREPLY=( $(compgen -W "$device_cmds" -- $cur) )
;;
devices)
COMPREPLY=( $(compgen -W "$devices_cmds" -- $cur) )
;;
env)
COMPREPLY=( $(compgen -W "$env_cmds" -- $cur) )
;;
Expand Down
91 changes: 56 additions & 35 deletions docs/balena-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ are encouraged to regularly update the balena CLI to the latest version.
- [build](#build)
- [deploy](#deploy)

- Device-type

- [device-type list](#device-type-list)

- Devices

- [device deactivate](#device-deactivate)
Expand Down Expand Up @@ -220,7 +224,6 @@ are encouraged to regularly update the balena CLI to the latest version.
- [device stop-service](#device-stop-service)
- [device track-fleet](#device-track-fleet)
- [device tunnel](#device-tunnel)
- [devices supported](#devices-supported)

- Environment Variables

Expand Down Expand Up @@ -397,7 +400,7 @@ should be provided. Organization handles can be listed with the
`balena organization list` command.

The app's default device type is specified with the `--type` option.
The `balena devices supported` command can be used to list the available
The `balena device-type list` command can be used to list the available
device types.

Interactive dropdowns will be shown for selection if no device type or
Expand Down Expand Up @@ -426,7 +429,7 @@ handle of the organization the app should belong to

#### -t, --type TYPE

app device type (Check available types with `balena devices supported`)
app device type (Check available types with `balena device-type list`)

# Authentication

Expand Down Expand Up @@ -527,7 +530,7 @@ should be provided. Organization handles can be listed with the
`balena organization list` command.

The block's default device type is specified with the `--type` option.
The `balena devices supported` command can be used to list the available
The `balena device-type list` command can be used to list the available
device types.

Interactive dropdowns will be shown for selection if no device type or
Expand Down Expand Up @@ -556,7 +559,7 @@ handle of the organization the block should belong to

#### -t, --type TYPE

block device type (Check available types with `balena devices supported`)
block device type (Check available types with `balena device-type list`)

# Config

Expand Down Expand Up @@ -638,7 +641,7 @@ custom device key - note that this is only supported on balenaOS 2.0.3+

#### --deviceType DEVICETYPE

device type slug (run 'balena devices supported' for possible values)
device type slug (run 'balena device-type list' for possible values)

#### --generate-device-api-key

Expand Down Expand Up @@ -1220,6 +1223,47 @@ Docker host TLS certificate file

Docker host TLS key file

# Device-type

## device-type list

### Aliases

- `devices supported`


To use one of the aliases, replace `device-type list` with the alias.

### Description

List the device types supported by balena (like 'raspberrypi3' or 'intel-nuc').

By default, only actively supported device types are listed.
The --all option can be used to list all device types, including those that are
no longer supported by balena.

The --json option is recommended when scripting the output of this command,
because the JSON format is less likely to change and it better represents data
types like lists and empty strings (for example, the ALIASES column contains a
list of zero or more values). The 'jq' utility may be helpful in shell scripts
(https://stedolan.github.io/jq/manual/).

Examples:

$ balena device-type list
$ balena device-type list --all
$ balena device-type list --json

### Options

#### -j, --json

produce JSON output instead of tabular output

#### --all

include device types no longer supported by balena

# Devices

## device deactivate
Expand Down Expand Up @@ -1826,7 +1870,7 @@ custom uuid

#### --deviceType DEVICETYPE

device type slug (run 'balena devices supported' for possible values)
device type slug (run 'balena device-type list' for possible values)

## device rename

Expand Down Expand Up @@ -2138,29 +2182,6 @@ device UUID or fleet name/slug

port mapping in the format <remotePort>[:[localIP:]localPort]

## devices supported

### Description

List the supported device types (like 'raspberrypi3' or 'intel-nuc').

The --json option is recommended when scripting the output of this command,
because the JSON format is less likely to change and it better represents data
types like lists and empty strings (for example, the ALIASES column contains a
list of zero or more values). The 'jq' utility may be helpful in shell scripts
(https://stedolan.github.io/jq/manual/).

Examples:

$ balena devices supported
$ balena devices supported --json

### Options

#### -j, --json

produce JSON output instead of tabular output

# Environment Variables

## env list
Expand Down Expand Up @@ -2479,7 +2500,7 @@ should be provided. Organization handles can be listed with the
`balena organization list` command.

The fleet's default device type is specified with the `--type` option.
The `balena devices supported` command can be used to list the available
The `balena device-type list` command can be used to list the available
device types.

Interactive dropdowns will be shown for selection if no device type or
Expand Down Expand Up @@ -2508,7 +2529,7 @@ handle of the organization the fleet should belong to

#### -t, --type TYPE

fleet device type (Check available types with `balena devices supported`)
fleet device type (Check available types with `balena device-type list`)

## fleet

Expand Down Expand Up @@ -2992,7 +3013,7 @@ expiry date assigned to generated provisioning api key (format: YYYY-MM-DD)
### Description

Download an unconfigured OS image for the specified device type.
Check available device types with 'balena devices supported'.
Check available device types with 'balena device-type list'.

Note: Currently this command only works with balenaCloud, not openBalena.
If using openBalena, please download the OS from: https://www.balena.io/os/
Expand Down Expand Up @@ -3071,7 +3092,7 @@ path to OS image

#### -t, --type TYPE

device type (Check available types with `balena devices supported`)
device type (Check available types with `balena device-type list`)

#### -d, --drive DRIVE

Expand All @@ -3088,7 +3109,7 @@ answer "yes" to all questions (non interactive use)
### Description

Show the available balenaOS versions for the given device type.
Check available types with `balena devices supported`.
Check available types with `balena device-type list`.

balenaOS ESR versions can be listed with the '--esr' option. See also:
https://www.balena.io/docs/reference/OS/extended-support-release/
Expand Down
Loading

0 comments on commit f52e218

Please sign in to comment.