]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
changes from review
authorJosef Reidinger <jreidinger@suse.cz>
Tue, 26 May 2015 08:52:17 +0000 (10:52 +0200)
committerJosef Reidinger <jreidinger@suse.cz>
Tue, 26 May 2015 08:52:17 +0000 (10:52 +0200)
client/snapper.cc
doc/snapper.xml.in
package/snapper.changes

index 6ae90ccb627a6d25948094c86764fa89687c30ec..00f2c91b3ce8020c94928492402bd853d4106fed 100644 (file)
@@ -87,6 +87,7 @@ bool utc = false;
 bool iso = false;
 string config_name = "root";
 bool no_dbus = false;
+string target_root = "/";
 
 
 struct MyFiles : public Files
@@ -210,7 +211,7 @@ help_list_configs()
 
 
 list<pair<string, string>>
-enum_configs(DBus::Connection* conn, const string& target_root = "/")
+enum_configs(DBus::Connection* conn)
 {
     list<pair<string, string>> configs;
 
@@ -238,11 +239,7 @@ enum_configs(DBus::Connection* conn, const string& target_root = "/")
 void
 command_list_configs(DBus::Connection* conn, Snapper* snapper)
 {
-    const struct option options[] = {
-      { "target-root",        optional_argument,      0,      'r' },
-      { 0, 0, 0, 0 }
-    };
-    GetOpts::parsed_opts opts = getopts.parse("list-configs", options);
+    GetOpts::parsed_opts opts = getopts.parse("list-configs", GetOpts::no_options);
 
     if (getopts.hasArgs())
     {
@@ -250,13 +247,6 @@ command_list_configs(DBus::Connection* conn, Snapper* snapper)
        exit(EXIT_FAILURE);
     }
 
-    string target_root = "/";
-
-    GetOpts::parsed_opts::const_iterator opt;
-
-    if ((opt = opts.find("target-root")) != opts.end())
-       target_root = opt->second;
-
     Table table;
 
     TableHeader header;
@@ -264,7 +254,7 @@ command_list_configs(DBus::Connection* conn, Snapper* snapper)
     header.add(_("Subvolume"));
     table.setHeader(header);
 
-    list<pair<string, string> > configs = enum_configs(conn, target_root);
+    list<pair<string, string> > configs = enum_configs(conn);
 
     for (list<pair<string,string> >::iterator it = configs.begin(); it != configs.end(); ++it)
     {
@@ -1588,6 +1578,7 @@ help(const list<Cmd>& cmds)
         << _("\t--table-style, -t <style>\tTable style (integer).") << endl
         << _("\t--config, -c <name>\t\tSet name of config to use.") << endl
         << _("\t--no-dbus\t\t\tOperate without DBus.") << endl
+        << _("\t--root, -r <path>\t\tOperate on target root (works only without DBus).") << endl
         << _("\t--version\t\t\tPrint version and exit.") << endl
         << endl;
 
@@ -1639,6 +1630,7 @@ main(int argc, char** argv)
        { "table-style",        required_argument,      0,      't' },
        { "config",             required_argument,      0,      'c' },
        { "no-dbus",            no_argument,            0,      0 },
+       { "root",               required_argument,      0,      'r' },
        { "version",            no_argument,            0,      0 },
        { "help",               no_argument,            0,      0 },
        { 0, 0, 0, 0 }
@@ -1681,6 +1673,17 @@ main(int argc, char** argv)
     if ((opt = opts.find("no-dbus")) != opts.end())
        no_dbus = true;
 
+    if ((opt = opts.find("root")) != opts.end())
+    {
+       target_root = opt->second;
+        if (!no_dbus)
+        {
+            cerr << _("root argument can be used only together with no-dbus.") << endl
+                 << _("Try 'snapper --help' for more information.") << endl;
+            exit(EXIT_FAILURE);
+        }
+    }
+
     if ((opt = opts.find("version")) != opts.end())
     {
        cout << "snapper " << Snapper::compileVersion() << endl;
index 4b000d04c31c9b5ff082eb994fc0226e50e51372..5e09c4f4bae5b9cc64f2722e74e52802a09a14b6 100644 (file)
          modifications made to the system.</para>
        </listitem>
       </varlistentry>
+      <varlistentry>
+       <term><option>-c, --root <replaceable>path</replaceable></option></term>
+       <listitem>
+         <para>Operate on target root. Only works together with no-dbus and only for some commands.</para>
+       </listitem>
+      </varlistentry>
       <varlistentry>
        <term><option>--version</option></term>
        <listitem>
index 527184f71d6792e8fdd57e111238e75318536dba..7743b7453c0fd9616fde432a4c8166ee0ca2aae5 100644 (file)
@@ -2,7 +2,7 @@
 Mon May 25 11:41:59 UTC 2015 - jreidinger@suse.com
 
 - allow list-configs command to work on different root
-  (fate#317900)
+  (for fate#317900)
 
 -------------------------------------------------------------------
 Fri May 22 07:15:24 UTC 2015 - igonzalezsosa@suse.com