[GRADLE-372] To respect a very common command-line idiom, Gradle should make the '-f' flag correspond to '--buildfile' not --full-stacktrace Created: 26/Jan/09  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jon Cox Assignee: Unassigned
Resolution: Won't Fix Votes: 0


For the vast majority of programs that can be run on the command line,
the meaning most people associate with the '-f 'flag is "file",
not "give me a full stack trace".

Thus, it's un-idiomatic & clumsy-feeling to say: gradle -b xxx.gradle
when you are trying to pass gradle its buildfile explicitly.
Most people will naturally want to type: gradle -f xxx.gradle

Consider the following command line options for gradle:

  • -s, --stacktrace
    Print out the stacktrace also for user exceptions (e.g. compile error).
  • -f, --full-stacktrace
    Print out the full (very verbose) stacktrace for any exceptions.
  • -b, --buildfile
    Specifies the build file name (also for subprojects). Defaults to build. gradle.

I think there's a pretty strong argument for making the '-f' switch
correspond to what the '-b' switch means now. The very verbose
stack trace should probably move to another name. Given that
's' means stacktrace, moving "-full-stacktrace" over to something
like '-S' might make sense.

Of course, there are legitimate exceptions to every rule, but it's best
to abide by conventions like this when possible. In Gradle's case,
I think it is. Note that the most common meaning for -b is something
like "binary mode" which makes no sense for a program like gradle.
Hence, there's no harm in letting both 'b' and '-f' mean "-buildfile".
Note: -b has no special meaning for GNU Make, so it's not like we'd
be leaving a banana peel on the floor; also, -f in make corresponds,
to --buildfile in Gradle, following the standard Unix idiom).

Gradle is such a new program and '-f' seems like such a seldom-used
thing in the grand scheme of it all, that a fix for this irritation should happen ASAP,
if folks think that it should happen at all. Obviously, I think it should!

Some time ago, I did a survey of Unix command line tools in the wild, and added
the most frequent patterns I saw to a very nice list of common idioms at:

Here are the results, along with examples of programs
that use various flags:

     -a      append          tee -a
                all             ls -a

        -b      bit
                binary mode

        -c      count           grep -c
                command         sh -c <command>

        -d      directory       cpio -d
                debug           perl -d:ptkdb

        -e      execute         perl -e

        -f      from file       grep -f
                force           rm -f

        -g      gui mode
                symbolic info

        -G      no-group        ls -G           (annoying)

        -h      help

        -i      ignore          grep -i
                interactive     rm -i

        -I      include         gcc -I...

        -j      bzip            tar -j

        -k      keep original   bzip -k
                keep going      make -k
                kilobytes       du -k

        -l      long format
                list files
                line count
                login name      ssh -l

        -L      follow symlinks

        -m      mode
                merge           diff3 -m
                megabytes       du -m

        -n      numeric         sort -n
                non-interactive rsh -n

        -o      output file     gcc -o

        -p      process path    mkdir -p
                process id      ps -p

        -q      quiet mode      grep -q

        -r      reverse order   sort -r
                recursive       rm -r          (could use -R)

        -R      recursive       chmod -R

        -s      silent          cat -s         (-q would have been nicer)
                socket          irpty -s

        -t      table           tar -t
                time sort       ls -t
                trace           autoconf -t

        -u      unique          sort -u
                unbuffered      cat -u
                sort by access  ls -u

        -v      version         perl -v        Note:  -v means "version" about 2x as often as it means "verbose" in unix man pages
                verbose         tar -v

        -w      width           pr -w
                wide            ps -w
                words           wc -w

        -x      extract         tar -x
                by line         ls -x

        -y      yes             shutdown -y
                year            ncal -y

        -z      is compressed   tar -z

Anyway, I'd be very interested to hear what others think about this.

Comment by Hans Dockter [ 08/Feb/09 ]

Thanks a lot for this. We should tackle this in the same go, as we change our command line stuff how to call and exclude tasks.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:28:29 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.