}
+ void
+ Snapshot::setDescription(const string& desc)
+ {
+ description = desc;
+ writeInfo();
+ }
+
+
void
Snapshots::read()
{
setChildValue(node, "date", datetime(date, true, true));
- if ((type == SINGLE || type == PRE) && !description.empty())
+ if (!description.empty())
setChildValue(node, "description", description);
if (type == POST)
time_t getDate() const { return date; }
+ void setDescription(const string& description);
string getDescription() const { return description; }
unsigned int getPreNum() const { return pre_num; }
time_t date;
- string description; // empty for type=POST
+ string description; // likely empty for type=POST
unsigned int pre_num; // valid only for type=POST
bool writeInfo() const;
bool createFilesystemSnapshot() const;
bool deleteFilesystemSnapshot() const;
+
};
}
+void
+help_modify()
+{
+ cout << _(" Modify snapshot:") << endl
+ << _("\tsnapper modify <number>") << endl
+ << endl
+ << _(" Options for 'modify' command:") << endl
+ << _("\t--description, -d <description>\tDescription for snapshot.") << endl
+ << endl;
+}
+
+
+void
+command_modify()
+{
+ const struct option options[] = {
+ { "description", required_argument, 0, 'd' },
+ { 0, 0, 0, 0 }
+ };
+
+ GetOpts::parsed_opts opts = getopts.parse("modify", options);
+ if (getopts.numArgs() != 1)
+ {
+ cerr << _("Command 'modify' need one argument.") << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ Snapshots::iterator snapshot = readNum(getopts.popArg());
+
+ GetOpts::parsed_opts::const_iterator it;
+
+ if ((it = opts.find("description")) != opts.end())
+ snapshot->setDescription(it->second);
+}
+
+
void
help_delete()
{
help_list();
help_create();
+ help_modify();
help_delete();
help_diff();
help_rollback();
cmds["list"] = command_list;
cmds["create"] = command_create;
+ cmds["modify"] = command_modify;
cmds["delete"] = command_delete;
cmds["diff"] = command_diff;
cmds["rollback"] = command_rollback;