Will,

The help system for go commands is provided by the help subcommand.

$ go help   

For example,

$ go test -h      
usage: go test [build/test flags] [packages] [build/test flags & test 
binary flags]    
Run 'go help test' and 'go help testflag' for details.    
$    

If you want to change that to a flags style -h help system then that 
warrants a proposal, not cherry-picking the go clean command.

I find go clean -h to be helpful:

$ go clean -h
usage: go clean [clean flags] [build flags] [packages]
Run 'go help clean' for details.
$ 

Peter


On Saturday, June 22, 2024 at 3:04:33 AM UTC-4 Will Faught wrote:

> Sure thing.
>
> Just want to make sure we're on the same page. We would be changing the 
> clean command help message to document its clean and build flags like the 
> flags package does:
>
> usage: go clean [clean flags] [build flags] [packages]
>
>   -i    remove the corresponding installed archive or binary (what 'go 
> install' would create)
>   -n    print the remove commands it would execute, but not run them
>   -r    apply recursively to all the dependencies of the packages named by 
> the import paths
>   -a
>         force rebuilding of packages that are already up-to-date.
>   -p n
>         the number of programs, such as build commands or
>         test binaries, that can be run in parallel.
>         The default is GOMAXPROCS, normally the number of CPUs available.
>   -race
>         enable data race detection.
>         Supported only on linux/amd64, freebsd/amd64, darwin/amd64, 
> darwin/arm64, windows/amd64,
>         linux/ppc64le and linux/arm64 (only for 48-bit VMA).
> [...]
>
> Run 'go help clean' for details.
>
> The clean and build flags would be mixed together and ordered 
> alphabetically, like flags does.
>
> Does that look right?
>
> Will
>
> On Tue, Jun 18, 2024 at 9:50 AM Ian Lance Taylor <ia...@golang.org> wrote:
>
>> On Mon, Jun 17, 2024 at 10:52 PM Will Faught <will....@gmail.com> wrote:
>> >
>> > > People who already know what the command does can use that short 
>> summary to remind themselves of the available options.
>> >
>> > Which options do you mean? My point was that it doesn't document any 
>> options.
>>
>> Oh, sorry, I see what you mean.  That's true, that isn't very helpful.
>> Want to send a patch?
>>
>> Ian
>>
>> > On Mon, Jun 17, 2024 at 5:57 PM Ian Lance Taylor <ia...@golang.org> 
>> wrote:
>> >>
>> >> On Mon, Jun 17, 2024 at 5:28 PM will....@gmail.com
>> >> <will....@gmail.com> wrote:
>> >> >
>> >> > ❯ go clean -h
>> >> > usage: go clean [clean flags] [build flags] [packages]
>> >> > Run 'go help clean' for details.
>> >> >
>> >> > This just tells me to invoke another help command.
>> >> >
>> >> > The flags package has the opinion that command help should print the 
>> doc for flags. Shouldn't we do that for go clean -h too?
>> >>
>> >> The intent is that "go clean -h" prints a short summary.  People who
>> >> already know what the command does can use that short summary to
>> >> remind themselves of the available options.  For people who don't know
>> >> what the command does, there is "go help clean".
>> >>
>> >> Ian
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/de832509-9ece-42e0-9488-14e7c6c1d170n%40googlegroups.com.

Reply via email to