Skip to content

Commit

Permalink
feat(repo): add 'repo migrate <version>'
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Aug 5, 2019
1 parent f19ab9c commit 0b7aa14
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions IpfsCli/Commands/RepoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Ipfs.Cli
{
[Command(Description = "Manage the IPFS repository")]
[Subcommand("gc", typeof(RepoGCCommand))]
[Subcommand("migrate", typeof(RepoMigrateCommand))]
[Subcommand("stat", typeof(RepoStatCommand))]
[Subcommand("verify", typeof(RepoVerifyCommand))]
[Subcommand("version", typeof(RepoVersionCommand))]
Expand Down Expand Up @@ -80,5 +81,24 @@ protected override async Task<int> OnExecute(CommandLineApplication app)
}
}

[Command(Description = "Migrate to the version")]
class RepoMigrateCommand : CommandBase
{
RepoCommand Parent { get; set; }

[Argument(0, "version", "The version number of the repository")]
[Required]
public int Version { get; set; }

protected override async Task<int> OnExecute(CommandLineApplication app)
{
// TODO: Add option --pass
string passphrase = "this is not a secure pass phrase";
var ipfs = new IpfsEngine(passphrase.ToCharArray());

await ipfs.MigrationManager.MirgrateToVersionAsync(Version);
return 0;
}
}

}

0 comments on commit 0b7aa14

Please sign in to comment.