summaryrefslogtreecommitdiffstats
path: root/fish/fish.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-07-02 16:02:32 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-07-02 16:02:32 +0100
commit8863ecde5dba262c0736da7505a9fa3655ed42f6 (patch)
tree5b7676e4b332a2d0c5f34917f30140e29fb99dca /fish/fish.c
parent62e41312acd0f7fe7f3622a73d6f6efc27b1b511 (diff)
downloadlibguestfs-8863ecde5dba262c0736da7505a9fa3655ed42f6.tar.gz
libguestfs-8863ecde5dba262c0736da7505a9fa3655ed42f6.tar.xz
libguestfs-8863ecde5dba262c0736da7505a9fa3655ed42f6.zip
Add the guestfish 'time' command.
><fs> time sfdisk /dev/sda 0 0 0 , elapsed time: 6.12 seconds
Diffstat (limited to 'fish/fish.c')
-rw-r--r--fish/fish.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fish/fish.c b/fish/fish.c
index 90740d56..59348c3b 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -727,6 +727,8 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd)
else if (strcasecmp (cmd, "more") == 0 ||
strcasecmp (cmd, "less") == 0)
r = do_more (cmd, argc, argv);
+ else if (strcasecmp (cmd, "time") == 0)
+ r = do_time (cmd, argc, argv);
else
r = run_action (cmd, argc, argv);
@@ -760,6 +762,8 @@ list_builtin_commands (void)
"lcd", _("local change directory"));
printf ("%-20s %s\n",
"glob", _("expand wildcards in command"));
+ printf ("%-20s %s\n",
+ "time", _("measure time taken to run command"));
/* actions are printed after this (see list_commands) */
}
@@ -845,6 +849,12 @@ display_builtin_command (const char *cmd)
strcasecmp (cmd, "q") == 0)
printf (_("quit - quit guestfish\n"
" quit\n"));
+ else if (strcasecmp (cmd, "time") == 0)
+ printf (_("time - measure time taken to run command\n"
+ " time <command> [<args> ...]\n"
+ "\n"
+ " This runs <command> as usual, and prints the elapsed\n"
+ " time afterwards.\n"));
else
fprintf (stderr, _("%s: command not known, use -h to list all commands\n"),
cmd);