mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 01:36:39 +08:00
fish_indent: Print the failed files with --check
Also return the number of failed files. I decided to *just* print the filenames (newline-separated because NULLs are annoying here) to make it easier to deal with. See #7251.
This commit is contained in:
parent
a7305c7082
commit
7254dfecb2
|
@ -22,7 +22,7 @@ The following options are available:
|
|||
|
||||
- ``-i`` or ``--no-indent`` do not indent commands; only reformat to one job per line.
|
||||
|
||||
- ``-c`` or ``--check`` do not indent, only return 0 if the code is already indented as fish_indent would, 1 otherwise.
|
||||
- ``-c`` or ``--check`` do not indent, only return 0 if the code is already indented as fish_indent would, the number of failed files otherwise. Also print the failed filenames if not reading from stdin.
|
||||
|
||||
- ``-v`` or ``--version`` displays the current fish version and then exits.
|
||||
|
||||
|
|
|
@ -959,6 +959,8 @@ int main(int argc, char *argv[]) {
|
|||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
int retval = 0;
|
||||
|
||||
wcstring src;
|
||||
for (int i = 0; i < argc || (argc == 0 && i == 0); i++) {
|
||||
if (argc == 0 && i == 0) {
|
||||
|
@ -1028,7 +1030,10 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
case output_type_check: {
|
||||
if (output_wtext != src) {
|
||||
return 1;
|
||||
if (argc) {
|
||||
std::fwprintf(stderr, _(L"%s\n"), argv[i]);
|
||||
}
|
||||
retval++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1036,5 +1041,5 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
std::fputws(str2wcstring(colored_output).c_str(), stdout);
|
||||
}
|
||||
return 0;
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user