99)
1010
1111// TagsList lists an app's tags.
12- func (d * DryccCmd ) TagsList (appID string ) error {
12+ func (d * DryccCmd ) TagsList (appID , procType string ) error {
1313 s , appID , err := load (d .ConfigFile , appID )
1414
1515 if err != nil {
@@ -23,20 +23,22 @@ func (d *DryccCmd) TagsList(appID string) error {
2323 if len (config .Tags ) == 0 {
2424 d .Println (fmt .Sprintf ("No tags found in %s app." , appID ))
2525 } else {
26- table := d .getDefaultFormatTable ([]string {"PTYPE" , "TAG" })
27- for _ , key := range * sortKeys (config .Tags ) {
28- table .Append ([]string {
29- key ,
30- fmt .Sprintf ("%v" , config .Tags [key ]),
31- })
26+ if tags , ok := config .Tags [procType ]; ok {
27+ table := d .getDefaultFormatTable ([]string {"KEY" , "VALUE" })
28+ for _ , key := range * sortKeys (tags ) {
29+ table .Append ([]string {
30+ key ,
31+ fmt .Sprintf ("%v" , config.Tags [procType ][key ]),
32+ })
33+ }
34+ table .Render ()
3235 }
33- table .Render ()
3436 }
3537 return nil
3638}
3739
3840// TagsSet sets an app's tags.
39- func (d * DryccCmd ) TagsSet (appID string , tags []string ) error {
41+ func (d * DryccCmd ) TagsSet (appID , procType string , tags []string ) error {
4042 s , appID , err := load (d .ConfigFile , appID )
4143
4244 if err != nil {
@@ -51,8 +53,8 @@ func (d *DryccCmd) TagsSet(appID string, tags []string) error {
5153 d .Print ("Applying tags... " )
5254
5355 quit := progress (d .WOut )
54- configObj := api.Config {}
55- configObj .Tags = tagsMap
56+ configObj := api.Config {Tags : make ( map [ string ]api. ConfigTags ) }
57+ configObj .Tags [ procType ] = tagsMap
5658
5759 _ , err = config .Set (s .Client , appID , configObj )
5860 quit <- true
@@ -63,11 +65,11 @@ func (d *DryccCmd) TagsSet(appID string, tags []string) error {
6365
6466 d .Print ("done\n \n " )
6567
66- return d .TagsList (appID )
68+ return d .TagsList (appID , procType )
6769}
6870
6971// TagsUnset removes an app's tags.
70- func (d * DryccCmd ) TagsUnset (appID string , tags []string ) error {
72+ func (d * DryccCmd ) TagsUnset (appID , procType string , tags []string ) error {
7173 s , appID , err := load (d .ConfigFile , appID )
7274
7375 if err != nil {
@@ -78,15 +80,12 @@ func (d *DryccCmd) TagsUnset(appID string, tags []string) error {
7880
7981 quit := progress (d .WOut )
8082
81- configObj := api.Config {}
82-
83- tagsMap := make (map [string ]interface {})
84-
83+ configObj := api.Config {Tags : make (map [string ]api.ConfigTags )}
84+ configTags := make (api.ConfigTags )
8585 for _ , tag := range tags {
86- tagsMap [tag ] = nil
86+ configTags [tag ] = nil
8787 }
88-
89- configObj .Tags = tagsMap
88+ configObj .Tags [procType ] = configTags
9089
9190 _ , err = config .Set (s .Client , appID , configObj )
9291 quit <- true
@@ -97,7 +96,7 @@ func (d *DryccCmd) TagsUnset(appID string, tags []string) error {
9796
9897 d .Print ("done\n \n " )
9998
100- return d .TagsList (appID )
99+ return d .TagsList (appID , procType )
101100}
102101
103102func parseTags (tags []string ) (map [string ]interface {}, error ) {
0 commit comments