Skip to content

Commit 3297ab0

Browse files
authored
Rename add-ons to apps with deprecated backward compatibility (#627)
* Rename add-ons to apps with deprecated backward compatibility Rename all occurrences of add-ons and its variations in commands and flags to apps, with old commands/flags still available for backward compatibility. The Supervisor API still uses addons, so these occurrences are kept for now, along with the related variables which process them. When/if this API is changed, we can also rename these. * Change --apps in backups to --app * Improve grammer in backup descriptions Also make first letters caps as it's more common across the repo. * Fix previously present grammar issues highlighted in PR * Fix the missed apps->app changes
1 parent f79db56 commit 3297ab0

30 files changed

Lines changed: 214 additions & 187 deletions

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A clear and concise description of what the bug is.
99

1010
## Debug information
1111

12-
1. SSH Addon type
12+
1. SSH App type
1313

1414
- [ ] Community
1515
- [ ] Core
@@ -18,8 +18,8 @@ A clear and concise description of what the bug is.
1818
2. Version of the CLI
1919

2020
CLI Version:
21-
Add-on:
22-
Add-on version:
21+
App:
22+
App version:
2323

2424
3. Version of Home Assistant Core & the Home Assistant Supervisor
2525

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Project Overview
44
This is the official Home Assistant CLI tool written in Go, providing command-line
55
interface to interact with the Home Assistant Supervisor. The CLI enables users to
6-
manage add-ons, control the core system, handle audio/network settings, manage
6+
manage apps, control the core system, handle audio/network settings, manage
77
backups, and perform various system operations.
88

99
The CLI is communicating with the Supervisor using the Supervisor's HTTP REST API.
@@ -24,7 +24,7 @@ The CLI is communicating with the Supervisor using the Supervisor's HTTP REST AP
2424

2525
## Available Commands
2626
The CLI provides the following main command categories:
27-
- `addons` - Install, update, remove and configure Home Assistant add-ons
27+
- `apps` - Install, update, remove and configure Home Assistant apps
2828
- `audio` - Audio plug-in management
2929
- `authentication` - Authentication for Home Assistant users
3030
- `cli` - CLI plug-in management
@@ -78,4 +78,4 @@ The CLI provides the following main command categories:
7878
6. Create Pull Request
7979

8080
This CLI is designed to work with Home Assistant Supervisor API and is commonly used in
81-
Home Assistant Operating System environments, SSH add-ons, and development setups.
81+
Home Assistant Operating System environments, SSH apps, and development setups.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ All options are also available as `SUPERVISOR_` prefixed environment variables l
3232
Available commands:
3333

3434
```text
35-
addons Install, update, remove and configure Home Assistant add-ons
35+
apps Install, update, remove and configure Home Assistant apps
3636
audio Audio device handling.
3737
authentication Authentication for Home Assistant users.
3838
cli Get information, update or configure the Home Assistant cli backend
@@ -59,19 +59,19 @@ available on the device terminal when using the Home Assistant Operating System.
5959

6060
The CLI is automatically updated on those systems.
6161

62-
Furthermore, the SSH add-on (available in the add-on store) provides
63-
access to this tool and several community add-ons provide it as well (e.g.,
64-
the Visual Studio Code add-on).
62+
Furthermore, the SSH app (available in the app store) provides
63+
access to this tool and several community apps provide it as well (e.g.,
64+
the Visual Studio Code app).
6565

6666
## Developing & contributing
6767

6868
### Prerequisites
6969

7070
The CLI can interact remotely with the Home Assistant Supervisor using the
71-
`remote_api` add-on from the [developer add-ons repository](https://github.com/home-assistant/addons-development).
71+
`remote_api` app from the [developer app repository](https://github.com/home-assistant/addons-development).
7272

73-
After installing and starting the add-on, a token is shown in the `remote_api`
74-
add-on log, which is needed for further development.
73+
After installing and starting the app, a token is shown in the `remote_api`
74+
app log, which is needed for further development.
7575

7676
### Get the source code
7777

@@ -86,7 +86,7 @@ go run main.go info
8686
```
8787

8888
**Note**: Replace the `192.168.1.2` with the IP address of your Home Assistant
89-
instance running the `remote_api` add-on and use the token provided.
89+
instance running the `remote_api` app and use the token provided.
9090

9191
### Building
9292

cmd/addons.go renamed to cmd/apps.go

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
package cmd
22

33
import (
4+
"os"
45
"strings"
56

67
helper "github.com/home-assistant/cli/client"
78
log "github.com/sirupsen/logrus"
89
"github.com/spf13/cobra"
910
)
1011

11-
var addonsCmd = &cobra.Command{
12-
Use: "addons",
13-
Aliases: []string{"addon", "add-on", "add-ons", "ad"},
14-
Short: "Install, update, remove and configure Home Assistant add-ons",
12+
var appsCmd = &cobra.Command{
13+
Use: "apps",
14+
Aliases: []string{"app", "addons", "addon", "add-on", "add-ons", "ad"},
15+
Short: "Install, update, remove and configure Home Assistant apps",
1516
Long: `
16-
The addons command allows you to manage Home Assistant add-ons by exposing
17+
The apps command allows you to manage Home Assistant apps by exposing
1718
commands for installing, removing, configure and control them. It also provides
18-
information commands for add-ons.`,
19+
information commands for apps.`,
1920
Example: `
20-
ha addons logs core_ssh
21-
ha addons install core_ssh
22-
ha addons start core_ssh`,
21+
ha apps logs core_ssh
22+
ha apps install core_ssh
23+
ha apps start core_ssh`,
24+
PersistentPreRun: func(cmd *cobra.Command, args []string) {
25+
for idx, arg := range os.Args {
26+
if idx != 0 && (arg == "addons" || arg == "addon" || arg == "add-on" || arg == "add-ons" || arg == "ad") {
27+
cmd.PrintErrf("The use of '%s' is deprecated, please use 'apps' instead!\n", arg)
28+
}
29+
}
30+
rootCmd.PersistentPreRun(cmd, args)
31+
},
2332
Run: func(cmd *cobra.Command, args []string) {
24-
log.WithField("args", args).Debug("addons")
33+
log.WithField("args", args).Debug("apps")
2534

2635
section := "addons"
2736
command := ""
@@ -37,12 +46,12 @@ information commands for add-ons.`,
3746
}
3847

3948
func init() {
40-
log.Debug("Init addons")
49+
log.Debug("Init apps")
4150

42-
rootCmd.AddCommand(addonsCmd)
51+
rootCmd.AddCommand(appsCmd)
4352
}
4453

45-
func addonsCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
54+
func appsCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
4655
if len(args) != 0 {
4756
return nil, cobra.ShellCompDirectiveNoFileComp
4857
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import (
99
"github.com/spf13/cobra"
1010
)
1111

12-
var addonsChangelogCmd = &cobra.Command{
12+
var appsChangelogCmd = &cobra.Command{
1313
Use: "changelog [slug]",
1414
Aliases: []string{"cl", "ch"},
15-
Short: "Show changelog of a Home Assistant add-on",
15+
Short: "Show changelog of a Home Assistant app",
1616
Long: `
17-
This command shows the changelog of an add-on. It gives you what has been
17+
This command shows the changelog of an app. It gives you what has been
1818
changed in the latest version and tell you about possible breaking changes.`,
1919
Example: `
20-
ha addons changelog core_ssh
21-
ha addons changelog core_mosquitto`,
22-
ValidArgsFunction: addonsCompletions,
20+
ha apps changelog core_ssh
21+
ha apps changelog core_mosquitto`,
22+
ValidArgsFunction: appsCompletions,
2323
Args: cobra.ExactArgs(1),
2424
Run: func(cmd *cobra.Command, args []string) {
25-
log.WithField("args", args).Debug("addons changelog")
25+
log.WithField("args", args).Debug("apps changelog")
2626

2727
section := "addons"
2828
command := "{slug}/changelog"
@@ -61,5 +61,5 @@ ha addons changelog core_mosquitto`,
6161
}
6262

6363
func init() {
64-
addonsCmd.AddCommand(addonsChangelogCmd)
64+
appsCmd.AddCommand(appsChangelogCmd)
6565
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
var addonsInfoCmd = &cobra.Command{
9+
var appsInfoCmd = &cobra.Command{
1010
Use: "info [slug]",
1111
Aliases: []string{"in", "info"},
12-
Short: "Show information about available Home Assistant add-ons",
12+
Short: "Show information about available Home Assistant apps",
1313
Long: `
14-
This command can provide information on all available add-ons or, if a slug
15-
is provided, information about a specific add-on.
14+
This command can provide information on all available apps or, if a slug
15+
is provided, information about a specific app.
1616
`,
1717
Example: `
18-
ha addons info
19-
ha addons info core_ssh
18+
ha apps info
19+
ha apps info core_ssh
2020
`,
21-
ValidArgsFunction: addonsCompletions,
21+
ValidArgsFunction: appsCompletions,
2222
Args: cobra.MaximumNArgs(1),
2323
Run: func(cmd *cobra.Command, args []string) {
24-
log.WithField("args", args).Debug("addons info")
24+
log.WithField("args", args).Debug("apps info")
2525

2626
section := "addons"
2727
command := "{slug}/info"
@@ -58,5 +58,5 @@ is provided, information about a specific add-on.
5858
}
5959

6060
func init() {
61-
addonsCmd.AddCommand(addonsInfoCmd)
61+
appsCmd.AddCommand(appsInfoCmd)
6262
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
var addonsInstalCmd = &cobra.Command{
9+
var appsInstallCmd = &cobra.Command{
1010
Use: "install [slug]",
1111
Aliases: []string{"i", "inst"},
12-
Short: "Installs a Home Assistant add-on",
12+
Short: "Installs a Home Assistant app",
1313
Long: `
14-
This command allows you to install a Home Assistant add-on from the commandline.
14+
This command allows you to install a Home Assistant app from the commandline.
1515
`,
1616
Example: `
17-
ha addons install core_ssh
17+
ha apps install core_ssh
1818
`,
19-
ValidArgsFunction: storeAddonCompletions,
19+
ValidArgsFunction: storeAppCompletions,
2020
Args: cobra.ExactArgs(1),
2121
Run: func(cmd *cobra.Command, args []string) {
22-
log.WithField("args", args).Debug("addons install")
22+
log.WithField("args", args).Debug("apps install")
2323

2424
section := "addons"
2525
command := "{slug}/install"
@@ -56,5 +56,5 @@ This command allows you to install a Home Assistant add-on from the commandline.
5656

5757
func init() {
5858

59-
addonsCmd.AddCommand(addonsInstalCmd)
59+
appsCmd.AddCommand(appsInstallCmd)
6060
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
var addonsLogsCmd = &cobra.Command{
9+
var appsLogsCmd = &cobra.Command{
1010
Use: "logs [slug]",
1111
Aliases: []string{"log", "lg"},
12-
Short: "View the log output of a running Home Assistant add-on",
12+
Short: "View the log output of a running Home Assistant app",
1313
Long: `
14-
Allowing you to look at the log output generated by a Home Assistant add-on.
14+
Allowing you to look at the log output generated by a Home Assistant app.
1515
`,
1616
Example: `
17-
ha addons logs core_ssh
17+
ha apps logs core_ssh
1818
`,
19-
ValidArgsFunction: addonsCompletions,
19+
ValidArgsFunction: appsCompletions,
2020
Args: cobra.ExactArgs(1),
2121
Run: func(cmd *cobra.Command, args []string) {
22-
log.WithField("args", args).Debug("addons logs")
22+
log.WithField("args", args).Debug("apps logs")
2323

2424
section := "addons/{slug}"
2525

@@ -47,7 +47,7 @@ Allowing you to look at the log output generated by a Home Assistant add-on.
4747
}
4848

4949
func init() {
50-
addLogsFlags(addonsLogsCmd)
50+
addLogsFlags(appsLogsCmd)
5151

52-
addonsCmd.AddCommand(addonsLogsCmd)
52+
appsCmd.AddCommand(appsLogsCmd)
5353
}
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,25 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
var addonsRebuildForce bool
9+
var appsRebuildForce bool
1010

11-
var addonsRebuildCmd = &cobra.Command{
11+
var appsRebuildCmd = &cobra.Command{
1212
Use: "rebuild [slug]",
1313
Aliases: []string{"rb", "reinstall"},
14-
Short: "Rebuild a locally built Home Assistant add-on",
14+
Short: "Rebuild a locally built Home Assistant app",
1515
Long: `
16-
Most add-ons provide pre-built images Home Assistant can download and use.
16+
Most apps provide pre-built images Home Assistant can download and use.
1717
However, some don't. This is usually the case for local or development version
18-
of add-ons. This command allows you to trigger a rebuild of a locally built
19-
add-on.
18+
of apps. This command allows you to trigger a rebuild of a locally built app.
2019
`,
2120
Example: `
22-
ha addons rebuild local_my_addon
23-
ha addons rebuild local_my_addon --force
21+
ha apps rebuild local_my_app
22+
ha apps rebuild local_my_app --force
2423
`,
25-
ValidArgsFunction: addonsCompletions,
24+
ValidArgsFunction: appsCompletions,
2625
Args: cobra.ExactArgs(1),
2726
Run: func(cmd *cobra.Command, args []string) {
28-
log.WithField("args", args).Debug("addons rebuild")
27+
log.WithField("args", args).Debug("apps rebuild")
2928

3029
section := "addons"
3130
command := "{slug}/rebuild"
@@ -45,7 +44,7 @@ add-on.
4544
"slug": slug,
4645
})
4746

48-
if addonsRebuildForce {
47+
if appsRebuildForce {
4948
request.SetBody(map[string]interface{}{
5049
"force": true,
5150
})
@@ -67,6 +66,6 @@ add-on.
6766
}
6867

6968
func init() {
70-
addonsRebuildCmd.Flags().BoolVar(&addonsRebuildForce, "force", false, "Force rebuild of the add-on even if pre-built images are provided")
71-
addonsCmd.AddCommand(addonsRebuildCmd)
69+
appsRebuildCmd.Flags().BoolVar(&appsRebuildForce, "force", false, "Force rebuild of the app even if pre-built images are provided")
70+
appsCmd.AddCommand(appsRebuildCmd)
7271
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
var addonsRestartCmd = &cobra.Command{
9+
var appsRestartCmd = &cobra.Command{
1010
Use: "restart [slug]",
1111
Aliases: []string{"reboot"},
12-
Short: "Restarts a Home Assistant add-on",
12+
Short: "Restarts a Home Assistant app",
1313
Long: `
14-
Restart a Home Assistant add-on
14+
Restart a Home Assistant app
1515
`,
1616
Example: `
17-
ha addons restart core_ssh
17+
ha apps restart core_ssh
1818
`,
19-
ValidArgsFunction: addonsCompletions,
19+
ValidArgsFunction: appsCompletions,
2020
Args: cobra.ExactArgs(1),
2121
Run: func(cmd *cobra.Command, args []string) {
22-
log.WithField("args", args).Debug("addons restart")
22+
log.WithField("args", args).Debug("apps restart")
2323

2424
section := "addons"
2525
command := "{slug}/restart"
@@ -53,5 +53,5 @@ Restart a Home Assistant add-on
5353

5454
func init() {
5555

56-
addonsCmd.AddCommand(addonsRestartCmd)
56+
appsCmd.AddCommand(appsRestartCmd)
5757
}

0 commit comments

Comments
 (0)