Example #1
0
        /// <summary>
        /// See README.md
        /// </summary>
        public static void Main( string[] args )
        {
            if ( Settings.Default.Debug ) {
            Debugger.Launch();
              }

              var options = new CsMergeOptions();
              if ( !CommandLine.Parser.Default.ParseArguments( args, options ) ) {
            return;
              }

              if ( HandleConfigureOptions( options ) ) {
            return;
              }

              DirectoryInfo folder = new DirectoryInfo( options.InputFolder ?? Directory.GetCurrentDirectory() );
              var logger = LogManager.GetCurrentClassLogger();

              try {
            var rootFolder = GitHelper.FindRepoRoot( folder.FullName );

            ProcessMerge( logger, folder, rootFolder );
              }
              catch ( UserQuitException ) {
            Console.WriteLine( "The user quit." );
              }
              catch ( Exception exception ) {
            Console.WriteLine( $"An error occurred: {Environment.NewLine}{exception}" );
              }
        }
Example #2
0
        private static bool HandleConfigureOptions( CsMergeOptions options )
        {
            bool configured = false;

              if ( options.ConfigureGitConfig != null ) {
            ConfigurationLevel level;
            if ( Enum.TryParse( options.ConfigureGitConfig, true, out level ) ) {
              GitHelper.ConfigureGitConfig( level );
            }
            else {
              GitHelper.ConfigureGitConfig( file : options.ConfigureGitConfig );
            }
            configured = true;
              }

              if ( options.ConfigureGitAttributes != null ) {
            GitHelper.ConfigureGitAttrib( options.ConfigureGitAttributes );
            configured = true;
              }
              return configured;
        }