Re: [fossil-users] Help messages in add.c
On 15 July 2017 at 03:58, Johan Kuusewrote: > On Fri, Jul 14, 2017 at 9:23 PM, Venkat Iyer wrote: >> Consider me old fashioned, but the current behavior seems more in line with >> traditional unix (read sysv) commands. > > I don't want to make this a big deal, but I don't agree that the > commands behave the same way as traditional unix commands. > Examples: > fossil ls This will list all of the files of the repo if no path is specified. Unix ls will only list files in that directory. This is the documented behavior or fossil: List all files in the current checkout. If PATHS is included, only the named files (or their children if directories) are shown. https://www.fossil-scm.org/index.html/help?cmd=ls ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Help messages in add.c
On Fri, Jul 14, 2017 at 9:23 PM, Venkat Iyerwrote: > Consider me old fashioned, but the current behavior seems more in line with > traditional unix (read sysv) commands. I don't want to make this a big deal, but I don't agree that the commands behave the same way as traditional unix commands. Examples: # fossil rm (no output) # fossil mv Usage: fossil mv OLDNAME NEWNAME # rm rm: missing operand Try `rm --help' for more information. # mv mv: missing file operand Try `mv --help' for more information. The only difference between these commands is operating on a file system vs. a Fossil repository. "unix cat" and "fossil cat" are slightly different in that way that "unix cat" may be used with pipes or file redirection, while it makes no sense to use "fossil cat" that way. > Usage is when when the user made > an error or explicitly asked for help. As you see in the examples above, traditional unix commands consider missing operand an error. > The question would then be: > > Is "fossil cat" followed by > > a) zero or more paths > b) one or more paths > > I script fossil more (or use it through emacs vc) than use it command line. > I currently assume a).But it wouldn't kill me if b) became the default. > My > scripts will have to not exec fossil for no filenames. I also do fossil scripting, and find it useful to check for $? error codes after each "fossil" command. Anyway, "fossil rm" silently accepts uninitialized/empty variables as arguments, while "fossil mv" catches the error: dummy1= dummy2= fossil rm $dummy1; echo $? 0 fossil mv $dummy1 $dummy2; echo $? Usage: fossil mv OLDNAME NEWNAME 1 So even if the help message may be irrelevant in scripting I think "fossil rm" should at least return an error code on wrong usage. Best Regards, Johan > > -Venkat > > > > > > On Fri, Jul 14, 2017 at 12:56 AM, Johan Kuuse wrote: >> >> On Thu, Jul 13, 2017 at 6:31 PM, jungle Boogie >> wrote: >> > On 6 June 2017 at 06:50, Johan Kuuse wrote: >> >> Hi, >> >> >> >> The following commands, executed without any arguments, are mute: >> >> >> >> f add >> >> f rm >> >> f delete >> >> f forget >> >> >> >> IMHO, they should show a help message instead. >> >> >> > >> > Is it desired to not do anything with the command isn't followed by a >> > filename/argument? >> > >> >> I cannot I think of any situation where it should be desired not >> showing the help message. >> It's just a matter about being coherent, either you show a help >> message, or you don't. >> An example: >> >> The file src/add.c contains both the commands 'add' and 'mv' (among >> others). >> >> fossil add >> (no output) >> >> fossil mv >> Usage: fossil mv OLDNAME NEWNAME >> >> >> Just discovered that the following commands behave the same (no help >> message): >> f cat >> f sha1 >> f sha3 >> >> The two last commands may read from stdin, but even so, they require >> at least 1 argument, '-'. >> >> >> >> Index: src/add.c >> == >> --- src/add.c >> +++ src/add.c >> @@ -298,10 +298,13 @@ >>if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; >> >>/* We should be done with options.. */ >>verify_all_options(); >> >> + if( g.argc<3 ){ >> +usage("FILE..."); >> + } >>db_must_be_within_tree(); >>if( zCleanFlag==0 ){ >> zCleanFlag = db_get("clean-glob", 0); >>} >>if( zIgnoreFlag==0 ){ >> >> >> >> >> BR, >> Johan >> >> >> >> Best Regards, >> >> Johan >> > ___ >> > fossil-users mailing list >> > fossil-users@lists.fossil-scm.org >> > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users >> >> ___ >> fossil-users mailing list >> fossil-users@lists.fossil-scm.org >> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users >> > > > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Help messages in add.c
Consider me old fashioned, but the current behavior seems more in line with traditional unix (read sysv) commands. Usage is when when the user made an error or explicitly asked for help. The question would then be: Is "fossil cat" followed by a) zero or more paths b) one or more paths I script fossil more (or use it through emacs vc) than use it command line. I currently assume a).But it wouldn't kill me if b) became the default. My scripts will have to not exec fossil for no filenames. -Venkat On Fri, Jul 14, 2017 at 12:56 AM, Johan Kuusewrote: > On Thu, Jul 13, 2017 at 6:31 PM, jungle Boogie > wrote: > > On 6 June 2017 at 06:50, Johan Kuuse wrote: > >> Hi, > >> > >> The following commands, executed without any arguments, are mute: > >> > >> f add > >> f rm > >> f delete > >> f forget > >> > >> IMHO, they should show a help message instead. > >> > > > > Is it desired to not do anything with the command isn't followed by a > > filename/argument? > > > > I cannot I think of any situation where it should be desired not > showing the help message. > It's just a matter about being coherent, either you show a help > message, or you don't. > An example: > > The file src/add.c contains both the commands 'add' and 'mv' (among > others). > > fossil add > (no output) > > fossil mv > Usage: fossil mv OLDNAME NEWNAME > > > Just discovered that the following commands behave the same (no help > message): > f cat > f sha1 > f sha3 > > The two last commands may read from stdin, but even so, they require > at least 1 argument, '-'. > > > > Index: src/add.c > == > --- src/add.c > +++ src/add.c > @@ -298,10 +298,13 @@ >if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; > >/* We should be done with options.. */ >verify_all_options(); > > + if( g.argc<3 ){ > +usage("FILE..."); > + } >db_must_be_within_tree(); >if( zCleanFlag==0 ){ > zCleanFlag = db_get("clean-glob", 0); >} >if( zIgnoreFlag==0 ){ > > > > > BR, > Johan > > > >> Best Regards, > >> Johan > > ___ > > fossil-users mailing list > > fossil-users@lists.fossil-scm.org > > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > > ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Help messages in add.c
On Thu, Jul 13, 2017 at 6:31 PM, jungle Boogiewrote: > On 6 June 2017 at 06:50, Johan Kuuse wrote: >> Hi, >> >> The following commands, executed without any arguments, are mute: >> >> f add >> f rm >> f delete >> f forget >> >> IMHO, they should show a help message instead. >> > > Is it desired to not do anything with the command isn't followed by a > filename/argument? > I cannot I think of any situation where it should be desired not showing the help message. It's just a matter about being coherent, either you show a help message, or you don't. An example: The file src/add.c contains both the commands 'add' and 'mv' (among others). fossil add (no output) fossil mv Usage: fossil mv OLDNAME NEWNAME Just discovered that the following commands behave the same (no help message): f cat f sha1 f sha3 The two last commands may read from stdin, but even so, they require at least 1 argument, '-'. Index: src/add.c == --- src/add.c +++ src/add.c @@ -298,10 +298,13 @@ if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; /* We should be done with options.. */ verify_all_options(); + if( g.argc<3 ){ +usage("FILE..."); + } db_must_be_within_tree(); if( zCleanFlag==0 ){ zCleanFlag = db_get("clean-glob", 0); } if( zIgnoreFlag==0 ){ BR, Johan >> Best Regards, >> Johan > ___ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users Index: src/add.c == --- src/add.c +++ src/add.c @@ -298,10 +298,13 @@ if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; /* We should be done with options.. */ verify_all_options(); + if( g.argc<3 ){ +usage("FILE..."); + } db_must_be_within_tree(); if( zCleanFlag==0 ){ zCleanFlag = db_get("clean-glob", 0); } if( zIgnoreFlag==0 ){ ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Help messages in add.c
On 6 June 2017 at 06:50, Johan Kuusewrote: > Hi, > > The following commands, executed without any arguments, are mute: > > f add > f rm > f delete > f forget > > IMHO, they should show a help message instead. > Is it desired to not do anything with the command isn't followed by a filename/argument? > Best Regards, > Johan ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[fossil-users] Help messages in add.c
Hi, The following commands, executed without any arguments, are mute: f add f rm f delete f forget IMHO, they should show a help message instead. Best Regards, Johan fossil diff --unified Index: src/add.c == --- src/add.c +++ src/add.c @@ -290,10 +290,12 @@ const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ Glob *pIgnore, *pClean;/* Ignore everything matching the glob patterns */ unsigned scanFlags = 0;/* Flags passed to vfile_scan() */ int forceFlag; + if( g.argc<3 ) usage("FILE1 ?FILE2? ..."); + zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); forceFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; @@ -453,10 +455,12 @@ int removeFiles; int dryRunFlag; int softFlag; int hardFlag; Stmt loop; + + if( g.argc<3 ) usage("FILE1 ?FILE2? ..."); dryRunFlag = find_option("dry-run","n",0)!=0; softFlag = find_option("soft",0,0)!=0; hardFlag = find_option("hard",0,0)!=0; Index: src/add.c == --- src/add.c +++ src/add.c @@ -290,10 +290,12 @@ const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ Glob *pIgnore, *pClean;/* Ignore everything matching the glob patterns */ unsigned scanFlags = 0;/* Flags passed to vfile_scan() */ int forceFlag; + if( g.argc<3 ) usage("FILE1 ?FILE2? ..."); + zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); forceFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; @@ -453,10 +455,12 @@ int removeFiles; int dryRunFlag; int softFlag; int hardFlag; Stmt loop; + + if( g.argc<3 ) usage("FILE1 ?FILE2? ..."); dryRunFlag = find_option("dry-run","n",0)!=0; softFlag = find_option("soft",0,0)!=0; hardFlag = find_option("hard",0,0)!=0; ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users