Skip to content

Commit

Permalink
fix(build): packagePath argument default value didn't always work
Browse files Browse the repository at this point in the history
  • Loading branch information
m-s- committed Oct 12, 2021
1 parent 4da1b8e commit 1df212b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmf-cli/Commands/build/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ public BuildCommand(IFileSystem fileSystem) : base(fileSystem)
public override void Configure(Command cmd)
{
var packageRoot = FileSystemUtilities.GetPackageRoot(this.fileSystem);
var packagePath = ".";
if (packageRoot != null)
{
packagePath = this.fileSystem.Path.GetRelativePath(this.fileSystem.Directory.GetCurrentDirectory(), packageRoot.FullName);
}
var arg = new Argument<IDirectoryInfo>(
name: "packagePath",
parse: (argResult) => Parse<IDirectoryInfo>(argResult, "."),
parse: (argResult) => Parse<IDirectoryInfo>(argResult, packagePath),
isDefault: true)
{
Description = "Package Path"
};

cmd.AddArgument(arg);
if (packageRoot != null)
{
var packagePath = Path.GetRelativePath(Directory.GetCurrentDirectory(), packageRoot.FullName);
arg.SetDefaultValue(new DirectoryInfo(packagePath));
}

cmd.Handler = CommandHandler.Create<IDirectoryInfo>(Execute);
}

Expand Down

0 comments on commit 1df212b

Please sign in to comment.