Добавлена команда импорта import из архива tar.gz
This commit is contained in:
parent
cc85cdec78
commit
9c4c2c9d05
2 changed files with 127 additions and 0 deletions
32
source/app.d
32
source/app.d
|
@ -18,6 +18,30 @@ int main(string[] args)
|
|||
.add(new Command("init", "Initializing the repository for storing snapshots"))
|
||||
.add(new Command("status", "Checking the status of tracked files"))
|
||||
.add(new Command("diff", "Show changed data"))
|
||||
.add(new Command("import", "Import snapshot from a tar.gz archive")
|
||||
.add(new Argument("archive", "The path to the tar.gz archive file").required)
|
||||
.add(new Option("c", "comment", "Specify comment")
|
||||
.optional
|
||||
.validateEachWith(
|
||||
opt => opt.length > 0,
|
||||
"cannot be empty"
|
||||
)
|
||||
)
|
||||
.add(new Option("a", "author", "Specify author")
|
||||
.optional
|
||||
.validateEachWith(
|
||||
opt => opt.length > 0,
|
||||
"cannot be empty"
|
||||
)
|
||||
)
|
||||
.add(new Option("e", "email", "Specify email")
|
||||
.optional
|
||||
.validateEachWith(
|
||||
opt => opt.isValidEmail,
|
||||
"must contain an email address"
|
||||
)
|
||||
)
|
||||
)
|
||||
.add(new Command("export", "Export snapshot to a tar.gz archive")
|
||||
.add(new Argument("path", "Output directory path for the archive").required)
|
||||
.add(new Option("s", "snapshot", "Specify snapshot hash")
|
||||
|
@ -123,6 +147,14 @@ int main(string[] args)
|
|||
e.arg("path"),
|
||||
e.option("snapshot", ""),
|
||||
)
|
||||
)
|
||||
.on("import", i =>
|
||||
snag.importSnapshot(
|
||||
i.arg("archive"),
|
||||
i.option("comment", ""),
|
||||
i.option("author", ""),
|
||||
i.option("email", "")
|
||||
)
|
||||
);
|
||||
} catch (SnagException e) {
|
||||
e.print();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue