@@ -40,54 +40,30 @@ static Program()
4040 . Split ( "." )
4141 . Take ( 2 ) ) ;
4242
43- var process = new Process
44- {
45- StartInfo = new ProcessStartInfo
46- {
47- UseShellExecute = false ,
48- RedirectStandardOutput = true ,
49- FileName = "git.exe" ,
50- CreateNoWindow = true ,
51- WorkingDirectory = Environment . CurrentDirectory ,
52- Arguments = "rev-parse --abbrev-ref HEAD"
53- }
54- } ;
55-
56- try
57- {
58- process . Start ( ) ;
59- BranchName = process . StandardOutput . ReadToEnd ( ) . Trim ( ) ;
60- process . WaitForExit ( ) ;
61- }
62- catch ( Exception )
63- {
64- BranchName = "master" ;
65- }
66- finally
67- {
68- process . Dispose ( ) ;
69- }
43+ BranchName =
44+ jObject . ContainsKey ( "doc_branch" )
45+ ? jObject [ "doc_branch" ] . Value < string > ( )
46+ : "master" ;
7047 }
7148
7249 /// <summary>
7350 /// The branch name to include in generated docs to link back to the original source file
7451 /// </summary>
75- public static string BranchName { get ; set ; }
52+ public static string BranchName { get ; private set ; }
7653
7754 public static string BuildOutputPath { get ; }
7855
7956 /// <summary>
8057 /// The Elasticsearch documentation version to link to
8158 /// </summary>
82- public static string DocVersion { get ; set ; }
59+ public static string DocVersion { get ; private set ; }
8360
8461 public static string InputDirPath { get ; }
8562
8663 public static string OutputDirPath { get ; }
8764
88- private static int Main ( string [ ] args )
89- {
90- return Parser . Default . ParseArguments < DocGeneratorOptions > ( args )
65+ private static int Main ( string [ ] args ) =>
66+ Parser . Default . ParseArguments < DocGeneratorOptions > ( args )
9167 . MapResult (
9268 opts =>
9369 {
@@ -113,7 +89,6 @@ private static int Main(string[] args)
11389 }
11490 } ,
11591 errs => 1 ) ;
116- }
11792 }
11893
11994 public class DocGeneratorOptions
0 commit comments