Permalink
Browse files

Allow a files call to resolve an empty path as root (like the Ruby VMC).

  • Loading branch information...
1 parent 3c244ce commit 9e7bc9fce27f60710b8a31527deaecc847e06177 @caledh caledh committed Dec 22, 2011
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/IronFoundry.Cli/Files.cs
View
12 src/IronFoundry.Cli/Files.cs
@@ -10,15 +10,23 @@ static partial class Program
{
static bool Files(IList<string> unparsed)
{
- if (unparsed.Count != 2)
+ if (unparsed.Count > 2)
{
Console.Error.WriteLine("Too many arguments for [files]: {0}", String.Join(", ", unparsed.Select(s => String.Format("'{0}'", s))));
Console.Error.WriteLine("Usage: vmc files <appname> <path>"); // TODO usage statement standardization
return false;
}
+ if (unparsed.Count < 1)
+ {
+ Console.Error.WriteLine("Not enough arguments for [files]: {0}", String.Join(", ", unparsed.Select(s => String.Format("'{0}'", s))));
+ Console.Error.WriteLine("Usage: vmc files <appname> <path (optional)>"); // TODO usage statement standardization
+ return false;
+ }
string appname = unparsed[0];
- string path = unparsed[1];
+ string path = string.Empty;
+ if (unparsed.Count == 2)
+ path = unparsed[1];
IVcapClient vc = new VcapClient();
byte[] output = vc.FilesSimple(appname, path, 0);

0 comments on commit 9e7bc9f

Please sign in to comment.