Exemplo n.º 1
0
    public override void Help(HelpDetails details)
    {
      details.Comments = "This command makes use of Revolver expressions. See the extended help topic 'expressions' for more detail (help expressions)";

      details.AddExample("($var$ > 15 as number) (echo is it larger)");
      details.AddExample("(@title ? company) (sf title (the new title))");
    }
Exemplo n.º 2
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("(this is input) (^is$) (id)");
   details.AddExample("(this is input) (^(is)$) ($1id)");
   details.AddExample("(this is input) \\s -");
   details.AddExample("(This Is Input) is in -c");
 }
Exemplo n.º 3
0
 public override void Help(HelpDetails details)
 {
   var help = new HelpDetails
   {
     Description = Description()
   };
 }
Exemplo n.º 4
0
 public override void Help(HelpDetails details)
 {
   details.Comments = "One of language or -d must be used";
   details.AddExample("en");
   details.AddExample("zg-CH");
   details.AddExample("-d");
   details.AddExample("-f kk");
 }
Exemplo n.º 5
0
		public static HelpDetails UseEnvironmentVariable()
		{
			HelpDetails details = new HelpDetails();
			details.Description = "Allows substitution of environment variables into commands";
			details.Usage = "$name$";
			details.AddParameter("name", "The name of the environment variable");
			details.AddExample("$prevpath$");
			details.AddExample("$myvar$");
			details.AddExample("echo $prevpath$");
			return details;
		}
Exemplo n.º 6
0
		public static HelpDetails SubCommand()
		{
			HelpDetails details = new HelpDetails();
			details.Description = "Allows the evaluation of a command to be used as a parameter of another command";
			details.Usage = "< command";
			details.AddParameter("command", "The command to evaluate");
			details.AddExample("sf title < (gf -f title ../..)");
			details.AddExample("find echo < (ga -a key) < (ga -a id)");
			details.AddExample("cd < (ga -a templateid)");
			return details;
		}
Exemplo n.º 7
0
 public override void Help(HelpDetails details)
 {     
   details.Comments = "If using a path, zero based indexes can be used for instances of items having the same name. Indexes can also be used without names to select children by index. Brackets are not required to escape paths with spaces in item names";
   details.AddExample("item1");
   details.AddExample("item1/item2");
   details.AddExample("../item1");
   details.AddExample("{4763CBB5-54A2-4D50-BF41-64AA4DA881A5}");
   details.AddExample("samename[2]");
   details.AddExample("[3]");
   details.AddExample("/path/to my/ item");
 }
Exemplo n.º 8
0
    public HelpDetails GetScriptHelp(string name)
    {
      var scriptsItems = FindScriptItems(name);

      if (scriptsItems == null)
        return null;

      if (scriptsItems.Length == 1)
      {
        var scriptItem = scriptsItems[0];
        HelpDetails details = new HelpDetails();

        if (scriptItem[Constants.Fields.Description] != string.Empty)
          details.Description = scriptItem[Constants.Fields.Description];

        if (scriptItem[Constants.Fields.Usage] != string.Empty)
          details.Usage = scriptItem[Constants.Fields.Usage];

        if (scriptItem[Constants.Fields.Comments] != string.Empty)
          details.Comments = scriptItem[Constants.Fields.Comments];

        Item[] parameters = scriptItem.Axes.SelectItems("*[@@templatekey='script help parameter']");
        if (parameters != null)
        {
          for (int i = 0; i < parameters.Length; i++)
          {
            details.AddParameter(parameters[i][Constants.Fields.Name], parameters[i][Constants.Fields.Description]);
          }
        }

        Item[] examples = scriptItem.Axes.SelectItems("*[@@templatekey='script help example']");
        if (examples != null)
        {
          for (int i = 0; i < examples.Length; i++)
          {
            details.AddExample(examples[i][Constants.Fields.Example]);
          }
        }

        return details;
      }

      if (scriptsItems.Length > 1)
      {
        var scriptPaths = from script in scriptsItems
                          select script.Paths.FullPath;

        throw new MultipleScriptsFoundException(scriptPaths);
      }

      return null;
    }
Exemplo n.º 9
0
    public HelpDetails GetScriptHelp(string name)
    {
      var scriptSource = GetScript(name);

      // Check if the script exists. If not, return null
      if (scriptSource == null)
        return null;

      var helpData = ExtractHelpData(scriptSource);

      var details = new HelpDetails();
      foreach (var entry in helpData)
      {
        switch (entry.Key.ToLower())
        {
          case "comments":
            details.Comments += entry.Value;
            break;

          case "description":
            details.Description += entry.Value;
            break;

          case "example":
            details.AddExample(entry.Value);
            break;

          case "parameter":
            var idx = entry.Value.IndexOf(HelpCommentDelimiter);
            if (entry.Value.Length > idx)
            {
              var key = entry.Value.Substring(0, idx);
              var desc = entry.Value.Substring(idx + 1);

              details.AddParameter(key, desc);
            }
            
            break;

          case "usage":
            details.Usage = entry.Value;
            break;
        }
      }

      return details;
    }
Exemplo n.º 10
0
		public static HelpDetails Expressions()
		{
			HelpDetails details = new HelpDetails();
			details.Description = "Allows logical testing against fields and attributes";
			details.Usage = "[@field | @@attribute] operator [@field | @@attribute] [as cast] [with flag] [and | or expression]";
			details.AddParameter("operator", "How to compare the 2 arguments. Must be one of = (equals), < (less than), > (greater than), != (not equal), <= (less or equal), >= (greater or equal), [ (starts with), ] (ends with), ? (contains), !? (doesn't contain).");
			details.AddParameter("cast", "Treat the argument as a specific data type. Must be one of string, number, date.");
			details.AddParameter("flag", "Treat the argument in a specific way. Must be one of ignorecase, ignoredecimal, round, ceiling, floor.");
			details.AddParameter("expression", "Another expression. The operator (and, or) is used to determine the overall result");
			details.Comments = "Expressions are used as arguments to other commands such as find.";
			details.AddExample("@title != hello");
			details.AddExample("(@__created by) = admin with ignorecase");
			details.AddExample("@price >= 70 as number with round and @title = bananas with ignorecase");
			details.AddExample("@@key = a or @@key = b or @@key = c");
			details.AddExample("@__created = 12/01/2007 as date");
			details.AddExample("@@name [ a");
			return details;
		}
Exemplo n.º 11
0
		public static HelpDetails Prompt()
		{
			HelpDetails details = new HelpDetails();
			details.Description = "The prompt is set through the environment variable 'prompt'";
			//details.Usage = "[Any characters] [%path%] [%itemname%] [%ver%] [%db%] [%lang%] [%date%] [%time%] >";
            details.Usage = "[Any characters] [%path%] [%itemname%] [%ver%] [%db%] [%lang%] [%langcode%] [%date%] [%time%]";
			details.AddParameter("%path%", "Provides the full path of the current item");
			details.AddParameter("%itemname%", "Provides the name of the current item");
            details.AddParameter("%ver%", "Provides the version number of the current item");
			details.AddParameter("%db%", "Provides the name of the current database");
			details.AddParameter("%lang%", "Provides the title of the current language");
            details.AddParameter("%langcode", "Provides the code of the current language");
			details.AddParameter("%date%", "Provides the current date");
			details.AddParameter("%time%", "Provides the current time");
			//details.Comments = "The prompt must end with a right angle bracket '>'";
			details.AddExample("%db%:%path% >");
			details.AddExample("%date% %lang%|%itemname% >");
			return details;
		}
Exemplo n.º 12
0
 /// <summary>
 /// Generate a string from the given help details object
 /// </summary>
 /// <param name="details">The help details to print</param>
 public string PrintHelp(HelpDetails details)
 {
   return PrintHelp(details, string.Empty);
 }
Exemplo n.º 13
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("-i {493B3A83-0FA7-4484-8FC9-4680991CF743} pwd");
   details.AddExample("-i {493B3A83-0FA7-4484-8FC9-4680991CF743}|{543B3A83-0FA7-4484-8FC9-4680991CF797} pwd");
   details.AddExample("-t {493B3A83-0FA7-4484-8FC9-4680991CF743} (sf title hi)");
   details.AddExample("-t Document (sf title hi)");
   details.AddExample("-b MyBranch (sf title hi)");
   details.AddExample("-f title (a page for .*) (sf title hi)");
   details.AddExample("-f * sitecore pwd");
   details.AddExample("-f title (a page for .*) -fc (sf title hi)");
   details.AddExample("-r -f title (a page for .*) (sf title hi) /sitecore/content/home");
   details.AddExample("-t {493B3A83-0FA7-4484-8FC9-4680991CF743} -f title hi (sf title welcome)");
   details.AddExample("-ns -e (@__created > 3/1/2007 as date) pwd");
   details.AddExample("-so -e (@__created > 3/1/2007 as date)");
 }
Exemplo n.º 14
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("(my item) < ls");
   details.AddExample("publishing < ps");
 }
Exemplo n.º 15
0
    public override void Help(HelpDetails details)
    {
      var comments = new StringBuilder();
      Formatter.PrintLine("If 'targets' or 'languages' is not supplied the item will be published to all.", comments);
      comments.Append("Only one of -i, -s, -f or -r may be used.");

      details.Comments = comments.ToString();

      details.AddExample("-t web");
      details.AddExample("-t web|live");
      details.AddExample("-l en|de");
      details.AddExample("-t (target 1|target 2) -l en");
      details.AddExample("-f -w");
    }
Exemplo n.º 16
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("(<a id=\"myid\"></a>) (//@id)");
   details.AddExample("-h (<div><h1>title</h1><br><div class=top>the top</div></div>) //div[@class='top']");
   details.AddExample("-v (<a>val<b>subval</b></a>) ./a");
 }
Exemplo n.º 17
0
    public override void Help(HelpDetails details)
		{
      details.Comments = "With no 'mode' flags (g, btn, b, w) this command will run all validators defined.";
			//details.Usage = "<cmd> [path]";
		}
Exemplo n.º 18
0
    public override void Help(HelpDetails details)
    {
      details.Comments = "One of -a or -r must be specified";

      details.AddExample("-a a-b-c - d");
      details.AddExample("-r {945F96B9-5A7D-459C-8240-3A61362A0D32}|{F77216B8-5740-4680-A93A-227D0F897455} | {945F96B9-5A7D-459C-8240-3A61362A0D32}");
    }
Exemplo n.º 19
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("(title:home) pwd");
   details.AddExample("web (title:home AND text:lorem) (ga -a id)");
   details.AddExample("(_created:[20120903 TO 20120917]) pwd");
   details.AddExample("-v -l text:someterm pwd");
   details.AddExample("-so core name:sitecore");
 }
Exemplo n.º 20
0
 public override void Help(HelpDetails details)
 {
   details.Comments += "Extended paths can be used to specify a specific version.";
   details.AddExample("-ao");
   details.AddExample("item1/item2");
   details.AddExample("-al");
   details.AddExample("::4");
 }
Exemplo n.º 21
0
 public override void Help(HelpDetails details)
 {
 }
Exemplo n.º 22
0
 public override void Help(HelpDetails details)
 {
   details.Comments = "Either one of 'template', 'branch', 'xml' or -v argument must be provided. Name must be provided for template or branch.";
   details.AddExample("-t {493B3A83-0FA7-4484-8FC9-4680991CF743} newitem1");
   details.AddExample("-t Document newitem1");
   details.AddExample("-b Article newitem1");
   details.AddExample("-b Article newitem1 /item1");
   details.AddExample("-x <item xml data>");
   details.AddExample("-id -x <item xml data>");
   details.AddExample("-v");
 }
Exemplo n.º 23
0
    /// <summary>
    /// Generate a string from the given help details object
    /// </summary>
    /// <param name="details">The help details to print</param>
    /// <param name="binding">The name the command is bound to</param>
    public string PrintHelp(HelpDetails details, string binding)
    {
      StringBuilder sb = new StringBuilder(300);

      sb.Append(details.Description);
      sb.Append(_newLine);
      sb.Append(_newLine);
      sb.Append("Usage: ");
      sb.Append(_newLine);
      sb.Append("  ");
      sb.Append(details.Usage);
      sb.Append(_newLine);

      if (details.Parameters.Count > 0)
      {
        sb.Append(_newLine);
        sb.Append("Parameters:");
        sb.Append(_newLine);

        for (int i = 0; i < details.Parameters.Count; i++)
        {
          PrintDefinition(details.Parameters.Keys[i], 2, details.Parameters[i], sb);
        }
      }

      if (!string.IsNullOrEmpty(details.Comments))
      {
        sb.Append(_newLine);
        sb.Append("Comments:");
        sb.Append(_newLine);
        sb.Append("  ");
        sb.Append(details.Comments);
        sb.Append(_newLine);
      }

      if (details.Examples.Count > 0)
      {
        sb.Append(_newLine);
        sb.Append("Examples:");
        sb.Append(_newLine);

        for (int i = 0; i < details.Examples.Count; i++)
        {
          sb.Append("  ");
          sb.Append((string.IsNullOrEmpty(binding) ? string.Empty : binding + " ") + details.Examples[i]);
          sb.Append(_newLine);
        }
      }

      return sb.ToString();
    }
Exemplo n.º 24
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("");
   details.AddExample("(missing parameter)");
 }
Exemplo n.º 25
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("-n < (echo -i -f file.txt) (echo $current$)");
   details.AddExample("-s , 1,2,3,4 (touch -t document $current$)");
   details.AddExample("-s | < (gf -f multilist) (ga -a name $current$)");
 }
Exemplo n.º 26
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("-r");
   details.AddExample("../a/bb");
 }
Exemplo n.º 27
0
 public override void Help(HelpDetails details) {
   details.AddExample("/sitecore/content/home/a");
 }
Exemplo n.º 28
0
 public override void Help(HelpDetails details)
 {
   details.Comments = "If 'command' is not provided the available commands will be listed";
   details.AddExample("submit");
 }
Exemplo n.º 29
0
 public override void Help(HelpDetails details)
 {
   details.AddExample("10 2");
   details.AddExample("36 6");
 }
Exemplo n.º 30
0
    public override void Help(HelpDetails details)
    {
      var comments = new StringBuilder();
      Formatter.PrintLine("If echoing to a file and the filename given is not absolute the file will be written to the temp folder.", comments);
      comments.Append("-a and -i cannot be used together");

      details.Comments = comments.ToString();
      details.AddExample("this is input");
      details.AddExample("hello");
      details.AddExample("$prevpath$");
      details.AddExample("-f c:\\temp\\output.txt This is some output");
      details.AddExample("-f temp.xml < gi");
      details.AddExample("-a -f temp.txt < gf");
      details.AddExample("-i -f c:\\temp\\item.xml");
    }