File tree 1 file changed +18
-1
lines changed
src/Cli/Microsoft.TemplateEngine.Cli/Commands
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System . CommandLine ;
5
+ using System . CommandLine . Parsing ;
5
6
6
7
namespace Microsoft . TemplateEngine . Cli . Commands
7
8
{
@@ -11,7 +12,23 @@ public static class SharedOptions
11
12
{
12
13
Description = SymbolStrings . Option_Output ,
13
14
Required = false ,
14
- Arity = new ArgumentArity ( 1 , 1 )
15
+ Arity = new ArgumentArity ( 1 , 1 ) ,
16
+ CustomParser = ( ArgumentResult argumentResult ) =>
17
+ {
18
+ var input = argumentResult . Tokens [ 0 ] ? . Value ;
19
+ if ( string . IsNullOrWhiteSpace ( input ) )
20
+ {
21
+ return null ;
22
+ }
23
+ else if ( Path . EndsInDirectorySeparator ( input ) )
24
+ {
25
+ return new FileInfo ( input ) ;
26
+ }
27
+ else
28
+ {
29
+ return new FileInfo ( input + Path . DirectorySeparatorChar ) ;
30
+ }
31
+ }
15
32
} ;
16
33
17
34
public static Option < FileInfo > ProjectPathOption { get ; } = new Option < FileInfo > ( "--project" )
You can’t perform that action at this time.
0 commit comments