Exemple #1
0
    private int Run(ParametersModel p)
    {
      switch(p.Action)
      {
        case ActionType.Help: PrintHelp(p); break;
        case ActionType.CopyOnChange: CopyOnChange(p); break;
      }

      return 0;
    }
Exemple #2
0
    public ParametersModel GetParameters(string[] args)
    {
      var p = new ParametersModel();
      var optionSet = new Mono.Options.OptionSet();

      optionSet.Add("s=|source-file", "specify the source file to watch", s => p.SourceFile = s);
      optionSet.Add("t=|target-file", "specify the target file path", s => p.TargetFile = s);
      optionSet.Add("?|h|help", "prints this description", s => p.Action = ActionType.Help);
      p.OptionSet = optionSet;

      optionSet.Parse(args);

      return p;
    }
Exemple #3
0
 private void CopyOnChange(ParametersModel p)
 {
   CopyOnChange(p.SourceFile, p.TargetFile);
 }
Exemple #4
0
 private void PrintHelp(ParametersModel p)
 {
   p.OptionSet.WriteOptionDescriptions(Console.Out);
 }