File tree 3 files changed +35
-9
lines changed
3 files changed +35
-9
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,5 @@ $ md system
26
26
* ` lan `
27
27
* ` devices `
28
28
* ` apps `
29
+ * ` apps :appId ` - 通过应用id,查询应用的最新信息
29
30
* ...
Original file line number Diff line number Diff line change @@ -4,15 +4,16 @@ type App struct {
4
4
Id string `json:"id"`
5
5
Name string `json:"name"`
6
6
Author string `json:"author"`
7
- Icon string `json:"icon"`
8
- Source string `json:"source"`
9
- Version string `json:"size"`
7
+ Icon string `json:"icon,omitempty "`
8
+ Source string `json:"source,omitempty "`
9
+ Version string `json:"size,omitempty "`
10
10
Size int `json:"size"`
11
- Chksum string `json:"chksum"`
12
- ReleaseDate string `json:"releaseDate"`
11
+ IsRunning bool `json:"isRunning"`
12
+ Chksum string `json:"chksum,omitempty"`
13
+ ReleaseDate string `json:"releaseDate,omitempty"`
13
14
InstallDate string `json:"installDate"`
14
- Description string `json:"description"`
15
- Instruction string `json:"instruction"`
15
+ Description string `json:"description,omitempty "`
16
+ Instruction string `json:"instruction,omitempty "`
16
17
}
17
18
18
19
type Apps struct {
Original file line number Diff line number Diff line change 8
8
)
9
9
10
10
var cmdApps = cli.Command {
11
- Name : "apps" ,
12
- Usage : "List apps, show apps" ,
11
+ Name : "apps" ,
12
+ Usage : "List apps, show apps" ,
13
+ Action : runApps ,
13
14
Subcommands : []cli.Command {
14
15
{
15
16
Name : "list" ,
@@ -19,6 +20,17 @@ var cmdApps = cli.Command{
19
20
},
20
21
}
21
22
23
+ func runApps (c * cli.Context ) {
24
+ args := c .Args ()
25
+ if len (args ) == 0 {
26
+ cli .ShowSubcommandHelp (c )
27
+ return
28
+ }
29
+ appId := args .First ()
30
+ app := getAppInfoById (appId )
31
+ fmt .Println (app )
32
+ }
33
+
22
34
func runAppsList (c * cli.Context ) {
23
35
req , err := client .NewRequest ("GET" , "/plugin/installed_plugins" )
24
36
if err != nil {
@@ -29,3 +41,15 @@ func runAppsList(c *cli.Context) {
29
41
err = req .ToJSON (& result )
30
42
fmt .Println (result )
31
43
}
44
+
45
+ func getAppInfoById (id string ) api.App {
46
+ req , err := client .NewRequest ("GET" , "/plugin/plugin_latest_info" )
47
+ if err != nil {
48
+ fmt .Println (err )
49
+ }
50
+ req .SetCookie (config .Cookie )
51
+ req .QueryString ("id=" + id )
52
+ var result api.App
53
+ err = req .ToJSON (& result )
54
+ return result
55
+ }
You can’t perform that action at this time.
0 commit comments