On Fri, Jul 14, 2017 at 9:23 PM, Venkat Iyer <ven...@comit.com> 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 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 <jo...@kuu.se> wrote:
>>
>> On Thu, Jul 13, 2017 at 6:31 PM, jungle Boogie <jungleboog...@gmail.com>
>> wrote:
>> > On 6 June 2017 at 06:50, Johan Kuuse <jo...@kuu.se> 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

Reply via email to