Message ID | 20170103115813.GA3228@fedori (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
This is what I see when no arguments pare passed: $ ./btrfs-debugfs usage: btrfs-debugfs [-h] [-b] [-f] path [path ...] btrfs-debugfs: error: too few arguments And that's exactly the same output as with this patch applied. Am I missing something? -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Sorry about the misleading subject line. This patch is for missing optional arguments. Before the patch: $ ./btrfs-debugfs /mnt/file.txt # Does nothing and silently fails. After the patch: $ ./btrfs-debugfs /mnt/file.txt No arguments passed. Type 'btrfs-debugfs -h' for usage. ---- Cheers, Lakshmipathi.G FOSS Programmer. www.giis.co.in On Tue, Jan 3, 2017 at 8:16 PM, David Sterba <dsterba@suse.cz> wrote: > This is what I see when no arguments pare passed: > > $ ./btrfs-debugfs > usage: btrfs-debugfs [-h] [-b] [-f] path [path ...] > btrfs-debugfs: error: too few arguments > > And that's exactly the same output as with this patch applied. Am I missing > something? -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jan 03, 2017 at 08:58:44PM +0530, Lakshmipathi.G wrote: > Sorry about the misleading subject line. This patch is for missing > optional arguments. > > Before the patch: > $ ./btrfs-debugfs /mnt/file.txt # Does nothing and silently fails. > > After the patch: > $ ./btrfs-debugfs /mnt/file.txt > No arguments passed. Type 'btrfs-debugfs -h' for usage. That still looks confusing to me, as I'd count /mnt/file.txt as an argument. Even -h lists all the -h/-b/-f as optional arugments. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
I think we can achieve above help string with the help of custom usage function instead of using argparse default usage. I'll check and send a new patch. ---- Cheers, Lakshmipathi.G FOSS Programmer. www.giis.co.in On Wed, Jan 4, 2017 at 6:14 AM, Qu Wenruo <quwenruo@cn.fujitsu.com> wrote: > What about changing current help string to: > > btrfs-debugfs -b|-f path > or > btrfs-debugfs -h > > Thanks, > Qu -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/btrfs-debugfs b/btrfs-debugfs index dfb8853..70419fa 100755 --- a/btrfs-debugfs +++ b/btrfs-debugfs @@ -392,7 +392,9 @@ parser.add_argument('-f', '--file', action='store_const', const=1, help='get fil args = parser.parse_args() -if args.block_group: +if not (args.block_group or args.file): + print "No arguments passed. Type 'btrfs-debugfs -h' for usage." +elif args.block_group: for i in args.path[0:]: print_block_groups(i) elif args.file:
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in> --- btrfs-debugfs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)