Добавлена новая команда diff для просмотра внесенных изменений на текущий момент.
Добавлена возможность установки комментария, имени автора, электронной почты при создании снимка. Функции проверок через регулярные выражения перенесены в новый модуль lib.
This commit is contained in:
parent
eff4fa2fe6
commit
4301c27ca9
8 changed files with 90 additions and 36 deletions
44
source/app.d
44
source/app.d
|
@ -11,14 +11,37 @@ int main(string[] args)
|
|||
auto argumets = new Program(programName, snagVersion)
|
||||
.add(new Command("init", "Initializing the repository for storing snapshots"))
|
||||
.add(new Command("status", "Checking the status of tracked files"))
|
||||
.add(new Command("create", "Create a new backup"))
|
||||
.add(new Command("list", "List of backups")
|
||||
.add(new Command("diff", "Show changed data"))
|
||||
.add(new Command("create", "Create a new snapshot")
|
||||
.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("list", "List of snapshots")
|
||||
.add(new Flag("c", "comment", "Show comment")
|
||||
.name("comment")
|
||||
.optional
|
||||
)
|
||||
.add(new Flag("u", "user", "Show user")
|
||||
.name("user")
|
||||
.add(new Flag("a", "author", "Show author")
|
||||
.name("author")
|
||||
.optional
|
||||
)
|
||||
.add(new Flag("e", "email", "Show email")
|
||||
|
@ -33,7 +56,7 @@ int main(string[] args)
|
|||
.optional
|
||||
.validateEachWith(
|
||||
opt => opt.exists && opt.isFile,
|
||||
"A JSON file path must be provided"
|
||||
"must specify the path to the JSON file"
|
||||
)
|
||||
)
|
||||
.parse(args);
|
||||
|
@ -56,16 +79,23 @@ int main(string[] args)
|
|||
.on("init", init =>
|
||||
snag.initialize()
|
||||
)
|
||||
.on("diff", diff =>
|
||||
snag.diff()
|
||||
)
|
||||
.on("status", status =>
|
||||
snag.status()
|
||||
)
|
||||
.on("create", create =>
|
||||
snag.create()
|
||||
snag.create(
|
||||
create.option("comment", ""),
|
||||
create.option("author", ""),
|
||||
create.option("email", "")
|
||||
)
|
||||
)
|
||||
.on("list", list =>
|
||||
snag.list(
|
||||
list.flag("comment"),
|
||||
list.flag("user"),
|
||||
list.flag("author"),
|
||||
list.flag("email")
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue