File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ )
6+
7+ var hostDisksCmd = & cobra.Command {
8+ Use : "disks" ,
9+ Aliases : []string {"disk" },
10+ Short : "Manage host disk operations" ,
11+ Long : `
12+ The disks command provides access to disk-related operations on the host system
13+ that Home Assistant is running on.` ,
14+ Example : `
15+ ha host disks usage` ,
16+ }
17+
18+ func init () {
19+ hostCmd .AddCommand (hostDisksCmd )
20+ }
Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ helper "github.com/home-assistant/cli/client"
5+ log "github.com/sirupsen/logrus"
6+ "github.com/spf13/cobra"
7+ )
8+
9+ var hostDisksUsageCmd = & cobra.Command {
10+ Use : "usage" ,
11+ Aliases : []string {"us" , "use" },
12+ Short : "Get default disk usage information" ,
13+ Long : `
14+ This command provides information about the default disk usage on the host system
15+ that Home Assistant is running on.` ,
16+ Example : `
17+ ha host disks usage` ,
18+ ValidArgsFunction : cobra .NoFileCompletions ,
19+ Args : cobra .NoArgs ,
20+ Run : func (cmd * cobra.Command , args []string ) {
21+ log .WithField ("args" , args ).Debug ("host disks usage" )
22+
23+ section := "host"
24+ command := "disks/default/usage"
25+
26+ resp , err := helper .GenericJSONGet (section , command )
27+ if err != nil {
28+ helper .PrintError (err )
29+ ExitWithError = true
30+ } else {
31+ ExitWithError = ! helper .ShowJSONResponse (resp )
32+ }
33+ },
34+ }
35+
36+ func init () {
37+ hostDisksCmd .AddCommand (hostDisksUsageCmd )
38+ }
You can’t perform that action at this time.
0 commit comments