Implemented autosync, make it the default for guestfish.
[libguestfs.git] / fish / fish.c
index d256c2b..90f3a10 100644 (file)
@@ -82,6 +82,7 @@ usage (void)
           "  -h|--cmd-help cmd   Display detailed help on 'cmd'\n"
           "  -a image            Add image\n"
           "  -m dev[:mnt]        Mount dev on mnt (if omitted, /)\n"
+          "  -n|--no-sync        Don't autosync\n"
           /*"  --ro|-r             All mounts are read-only\n"*/
           "  -v|--verbose        Verbose messages\n"
           "For more information, see the manpage guestfish(1).\n");
@@ -96,6 +97,7 @@ main (int argc, char *argv[])
     { "cmd-help", 2, 0, 'h' },
     { "help", 0, 0, '?' },
     { "mount", 1, 0, 'm' },
+    { "no-sync", 0, 0, 'n' },
     { "verbose", 0, 0, 'v' },
     { 0, 0, 0, 0 }
   };
@@ -113,6 +115,8 @@ main (int argc, char *argv[])
     exit (1);
   }
 
+  guestfs_set_autosync (g, 1);
+
   for (;;) {
     c = getopt_long (argc, argv, options, long_options, NULL);
     if (c == -1) break;
@@ -153,6 +157,10 @@ main (int argc, char *argv[])
       mps = mp->next;
       break;
 
+    case 'n':
+      guestfs_set_autosync (g, 0);
+      break;
+
     case 'v':
       verbose++;
       guestfs_set_verbose (g, verbose);
@@ -239,7 +247,8 @@ script (int prompt)
   int len, i;
 
   if (prompt)
-    printf ("Welcome to guestfish, the libguestfs filesystem interactive shell for\n"
+    printf ("\n"
+           "Welcome to guestfish, the libguestfs filesystem interactive shell for\n"
            "editing virtual machine filesystems.\n"
            "\n"
            "Type: 'help' for help with commands\n"
@@ -334,7 +343,7 @@ issue_command (const char *cmd, char *argv[])
   }
   else if (strcasecmp (cmd, "cdrom") == 0) {
     if (argc != 1) {
-      fprintf (stderr, "use 'cdrom image' to add a guest cdrom\n");
+      fprintf (stderr, "use 'cdrom image' to add a CD-ROM image\n");
       return -1;
     }
     else
@@ -360,9 +369,9 @@ list_builtin_commands (void)
   printf ("%-20s %s\n",
          "quit", "quit guestfish");
   printf ("%-20s %s\n",
-         "add", "add  a guest image to be examined or modified");
+         "add", "add a guest image to be examined or modified");
   printf ("%-20s %s\n",
-         "cdrom", "add  a guest CD-ROM image to be examined");
+         "cdrom", "add a CD-ROM image to be examined");
   printf ("%-20s %s\n",
          "launch", "launch the subprocess");
 }
@@ -374,7 +383,7 @@ display_builtin_command (const char *cmd)
     printf ("add - add a guest image to be examined or modified\n"
            "     add <image>\n");
   else if (strcasecmp (cmd, "cdrom") == 0)
-    printf ("cdrom - add a guest CD-ROM image to be examined\n"
+    printf ("cdrom - add a CD-ROM image to be examined\n"
            "     cdrom <iso-file>\n");
   else if (strcasecmp (cmd, "help") == 0)
     printf ("help - display a list of commands or help on a command\n"