Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15451141
D10706.id25702.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10706.id25702.diff
View Options
diff --git a/src/workflow/ArcanistLintersWorkflow.php b/src/workflow/ArcanistLintersWorkflow.php
--- a/src/workflow/ArcanistLintersWorkflow.php
+++ b/src/workflow/ArcanistLintersWorkflow.php
@@ -11,7 +11,7 @@
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
- **linters** [__options__]
+ **linters** [__options__] [__search__ ...]
EOTEXT
);
}
@@ -21,6 +21,10 @@
Supports: cli
List the available and configured linters, with information about
what they do and which versions are installed.
+
+ If __search__ words are provided, only linters that match the search
+ will be printed. Search is case-insensitive, and performed against
+ name and configuration name of each linter.
EOTEXT
));
}
@@ -30,6 +34,7 @@
'verbose' => array(
'help' => pht('Show detailed information, including options.'),
),
+ '*' => 'search',
);
}
@@ -96,6 +101,10 @@
'error' => 'red',
);
+ $linter_info = $this->filterByNames(
+ $linter_info,
+ $this->getArgument('search'));
+
foreach ($linter_info as $key => $linter) {
$status = $linter['status'];
$color = $color_map[$status];
@@ -212,4 +221,19 @@
return $text_map;
}
+ private function filterByNames($linters, $search_terms) {
+ if (!$search_terms) {
+ return $linters;
+ }
+ $filtered = array();
+ $terms = '/'.implode('|', $search_terms).'/i';
+
+ foreach ($linters as $key => $linter) {
+ if (preg_match($terms, $linter['name']) ||
+ preg_match($terms, $linter['short'])) {
+ $filtered[$key] = $linter;
+ }
+ }
+ return $filtered;
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 29, 8:23 PM (3 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706374
Default Alt Text
D10706.id25702.diff (1 KB)
Attached To
Mode
D10706: arc linters: Filter by name, make display one-line
Attached
Detach File
Event Timeline
Log In to Comment