Skip to content

Commit 32ce48b

Browse files
committed
Fix usage line in help page to be path to program
This commit adjusts the help screen to display the path to this program rather than the name. Normally, this is the same as the binary, but in some cases it can be different. Conventionally, the path is shown. For instance, GNU cat does the following: $ cat --help Usage: cat [OPTION]... [FILE]... Which is not the name of the program, but the path: $ ln -s /usr/bin/cat dog $ ./dog --help Usage: ./dog [OPTION]... [FILE]... Concatenate FILE(s) to standard output.
1 parent 590cfec commit 32ce48b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

bin/jsonlint

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if (isset($_SERVER['argc']) && $_SERVER['argc'] > 1) {
3737
$quiet = true;
3838
} else {
3939
if ($arg == '-h' || $arg == '--help') {
40-
showUsage();
40+
showUsage($_SERVER['argv'][0]);
4141
} else {
4242
$files[] = $arg;
4343
}
@@ -106,9 +106,9 @@ function lintFile($file, $quiet = false)
106106
}
107107

108108
// usage text function
109-
function showUsage()
109+
function showUsage($programPath)
110110
{
111-
echo 'Usage: jsonlint file [options]'.PHP_EOL;
111+
echo 'Usage: '.$programPath.' file [options]'.PHP_EOL;
112112
echo PHP_EOL;
113113
echo 'Options:'.PHP_EOL;
114114
echo ' -q, --quiet Cause jsonlint to be quiet when no errors are found'.PHP_EOL;

0 commit comments

Comments
 (0)