1- using System ;
1+ // Copyright (c) 2020 Andreas Müller
2+ // This file is a part of Amusoft.VisualStudio.TemplateGenerator and is licensed under Apache 2.0
3+ // See https://github.com/taori/Amusoft.VisualStudio.TemplateGenerator/blob/master/LICENSE for details
4+
5+ using System ;
26using System . Collections . Generic ;
37using System . Linq ;
48using System . Threading ;
@@ -19,8 +23,7 @@ public class ConsoleApplication
1923
2024 [ ApplicationMetadata (
2125 Description = "Tries to build a template according the the specified configuration." ,
22- Syntax = "build [configName] [option: -s pathToStorage]"
23- ) ]
26+ Syntax = "build [configName] [option: -s pathToStorage]" ) ]
2427 public async Task < int > Build (
2528 [ Argument (
2629 Name = "config" ,
@@ -30,11 +33,12 @@ public async Task<int> Build(
3033 Description = "Path to storage." ,
3134 ShortName = "s" ,
3235 LongName = "storage" ) ]
33- string storage = null
34- )
36+ string storage = null )
3537 {
3638 if ( ! ConsoleUtils . TryGetManager ( storage , out var manager ) )
39+ {
3740 return 3 ;
41+ }
3842
3943 Log . Info ( $ "Trying to build [{ configurationId } ].") ;
4044
@@ -54,7 +58,9 @@ public async Task<int> Build(
5458 try
5559 {
5660 Log . Info ( $ "Executing build tool.") ;
57- var result = await rewriteTool . ExecuteAsync ( CancellationToken . None , new Progress < string > ( message => Console . WriteLine ( message ) ) ) ;
61+ var result = await rewriteTool . ExecuteAsync (
62+ CancellationToken . None ,
63+ new Progress < string > ( message => Console . WriteLine ( message ) ) ) ;
5864 return result ? 0 : 4 ;
5965 }
6066 catch ( Exception e )
@@ -63,7 +69,7 @@ public async Task<int> Build(
6369 return 1 ;
6470 }
6571 }
66-
72+
6773 [ SubCommand ]
6874 [ ApplicationMetadata ( Description = "Entry point for configurations" ) ]
6975 public class Configuration
@@ -77,7 +83,10 @@ public async Task<int> GetAll(
7783 string storage = null )
7884 {
7985 if ( ! ConsoleUtils . TryGetManager ( storage , out var manager ) )
86+ {
8087 return 1 ;
88+ }
89+
8190 var configurations = await manager . LoadStorageContentAsync ( ) ;
8291 for ( var index = 0 ; index < configurations . Length ; index ++ )
8392 {
@@ -91,19 +100,23 @@ public async Task<int> GetAll(
91100 [ ApplicationMetadata ( Description = "Renames the configuration if it can be found through the given id." ) ]
92101 public async Task < int > Rename (
93102 [ Argument (
94- Description = "id of configuration which can be the position of the configuration, its guid, or the configuration name" ) ]
95- string id ,
103+ Description =
104+ "id of configuration which can be the position of the configuration, its guid, or the configuration name" ) ]
105+ string id ,
96106 [ Argument (
97107 Description = "new name of the configuration" ) ]
98108 string newName ,
99109 [ Option (
100110 Description = "Path to storage." ,
101- ShortName = "s" ,
111+ ShortName = "s" ,
102112 LongName = "storage" ) ]
103113 string storage = null )
104114 {
105115 if ( ! ConsoleUtils . TryGetManager ( storage , out var manager ) )
116+ {
106117 return 1 ;
118+ }
119+
107120 try
108121 {
109122 var configuration = await manager . GetConfigurationByIdAsync ( id ) ;
0 commit comments