From patchwork Sun Jan 23 12:42:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hubert Kario X-Patchwork-Id: 498791 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0NCmgKm006321 for ; Sun, 23 Jan 2011 12:48:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115Ab1AWMsk (ORCPT ); Sun, 23 Jan 2011 07:48:40 -0500 Received: from dervish.wsisiz.edu.pl ([213.135.44.54]:33123 "EHLO dervish.wsisiz.edu.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065Ab1AWMsj (ORCPT ); Sun, 23 Jan 2011 07:48:39 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 23 Jan 2011 12:48:43 +0000 (UTC) X-Greylist: delayed 536 seconds by postgrey-1.27 at vger.kernel.org; Sun, 23 Jan 2011 07:48:38 EST Received: from localhost (localhost.localdomain [127.0.0.1]) by dervish.wsisiz.edu.pl (Postfix) with ESMTP id 34709C540FE for ; Sun, 23 Jan 2011 13:42:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wit.edu.pl; h= message-id:content-transfer-encoding:content-type:content-type :mime-version:in-reply-to:references:user-agent:date:date :subject:subject:from:from:received:received; s=amavisd; t= 1295786566; bh=srmBI0w9x2XXNhLjgby3VdlYyMv6INyLbw5BqGCX+xA=; b=s 6KdZ4/HYybH3v16sAjxX8ht5AjxoOSrDiU92wJ3ke7veZl/DEzSxjEQXHs5mFYK4 +VnZAhJ2WviEJFDg8y6BlZdj1okHu8+TvjPvlK98jiKbR2qYTctdhaTpbplMSiJq Bd5GkQ3URrACDAz9gG5lN2/7LW8BM+HN4wKQBbc1PQ= X-Virus-Scanned: amavisd-new at wit.edu.pl Received: from dervish.wsisiz.edu.pl ([127.0.0.1]) by localhost (dervish.wsisiz.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sgqeaUdAFnn3 for ; Sun, 23 Jan 2011 13:42:46 +0100 (CET) Received: from bursa23.localnet (bursa22.wsisiz.edu.pl [213.135.49.150]) by dervish.wsisiz.edu.pl (Postfix) with ESMTPSA id 95637C5404C for ; Sun, 23 Jan 2011 13:42:46 +0100 (CET) From: Hubert Kario To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] add detailed help messages to btrfs command Date: Sun, 23 Jan 2011 13:42:43 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-ARCH; KDE/4.5.5; i686; ; ) References: <201101231339.36599.kario@wit.edu.pl> In-Reply-To: <201101231339.36599.kario@wit.edu.pl> MIME-Version: 1.0 Message-Id: <201101231342.43637.kario@wit.edu.pl> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/btrfs.c b/btrfs.c index b84607a..bd6f6f8 100644 --- a/btrfs.c +++ b/btrfs.c @@ -23,6 +23,9 @@ #include "btrfs_cmds.h" #include "version.h" +#define BASIC_HELP 0 +#define ADVANCED_HELP 1 + typedef int (*CommandFunction)(int argc, char **argv); struct Command { @@ -31,8 +34,10 @@ struct Command { if >= 0, number of arguments, if < 0, _minimum_ number of arguments */ char *verb; /* verb */ - char *help; /* help lines; form the 2nd onward they are - indented */ + char *help; /* help lines; from the 2nd line onward they + are automatically indented */ + char *adv_help; /* advanced help message; from the 2nd line + onward they are automatically indented */ /* the following fields are run-time filled by the program */ char **cmds; /* array of subcommands */ @@ -47,73 +52,96 @@ static struct Command commands[] = { { do_clone, 2, "subvolume snapshot", " [/]\n" "Create a writable snapshot of the subvolume with\n" - "the name in the directory." + "the name in the directory.", + NULL }, { do_delete_subvolume, 1, "subvolume delete", "\n" - "Delete the subvolume ." + "Delete the subvolume .", + NULL }, { do_create_subvol, 1, "subvolume create", "[/]\n" "Create a subvolume in (or the current directory if\n" - "not passed)." + "not passed).", + NULL }, { do_subvol_list, 1, "subvolume list", "\n" - "List the snapshot/subvolume of a filesystem." + "List the snapshot/subvolume of a filesystem.", + NULL }, { do_find_newer, 2, "subvolume find-new", " \n" - "List the recently modified files in a filesystem." + "List the recently modified files in a filesystem.", + NULL }, { do_defrag, -1, "filesystem defragment", "[-vcf] [-s start] [-l len] [-t size] | [|...]\n" - "Defragment a file or a directory." + "Defragment a file or a directory.", + "[-vcf] [-s start] [-l len] [-t size] | [|...]\n" + "Defragment file data or directory metadata.\n" + "-v be verbose\n" + "-c compress the file while defragmenting\n" + "-f flush data to disk immediately after defragmenting\n" + "-s start defragment only from byte onward\n" + "-l len defragment only up to len bytes\n" + "-t size minimal size of file to be considered for defragmenting\n" }, { do_set_default_subvol, 2, "subvolume set-default", " \n" "Set the subvolume of the filesystem which will be mounted\n" - "as default." + "as default.", + NULL }, { do_fssync, 1, "filesystem sync", "\n" - "Force a sync on the filesystem ." + "Force a sync on the filesystem .", + NULL }, { do_resize, 2, "filesystem resize", "[+/-][gkm]|max \n" "Resize the file system. If 'max' is passed, the filesystem\n" - "will occupe all available space on the device." + "will occupe all available space on the device.", + NULL }, { do_show_filesystem, 999, "filesystem show", "[|