-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Add command to list running applications and their bundle IDs #257599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,91 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| # typed: strict | ||||||||||||||||||||||||||||||||||||||||||||
| # frozen_string_literal: true | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| require "abstract_command" | ||||||||||||||||||||||||||||||||||||||||||||
| require "open3" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| module Homebrew | ||||||||||||||||||||||||||||||||||||||||||||
| module Cmd | ||||||||||||||||||||||||||||||||||||||||||||
| class ListRunningAppIdsCmd < AbstractCommand | ||||||||||||||||||||||||||||||||||||||||||||
| cmd_args do | ||||||||||||||||||||||||||||||||||||||||||||
| usage_banner <<~EOS | ||||||||||||||||||||||||||||||||||||||||||||
| `list-running-app-ids` [<bundle-id>] | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Print a list of currently running Applications and associated | ||||||||||||||||||||||||||||||||||||||||||||
| Bundle IDs, which may be useful in a Cask uninstall stanza, eg | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| uninstall quit: 'bundle.id.goes.here' | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Applications attributed to Apple are excluded from the output. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| With optional <bundle-id>, silently test if a given app | ||||||||||||||||||||||||||||||||||||||||||||
| is running, setting a failing exit code if not. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| See CONTRIBUTING.md for more information. | ||||||||||||||||||||||||||||||||||||||||||||
| EOS | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| named_args :bundle_id, max: 1 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| hide_from_man_page! | ||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| sig { override.void } | ||||||||||||||||||||||||||||||||||||||||||||
| def run | ||||||||||||||||||||||||||||||||||||||||||||
| app_names, bundle_ids = load_apps | ||||||||||||||||||||||||||||||||||||||||||||
| test_bundle_id = args.named.first | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if test_bundle_id | ||||||||||||||||||||||||||||||||||||||||||||
| Homebrew.failed = true unless bundle_ids.include?(test_bundle_id) | ||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||
| report_apps(app_names, bundle_ids) | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+40
|
||||||||||||||||||||||||||||||||||||||||||||
| sig { override.void } | |
| def run | |
| app_names, bundle_ids = load_apps | |
| test_bundle_id = args.named.first | |
| if test_bundle_id | |
| Homebrew.failed = true unless bundle_ids.include?(test_bundle_id) | |
| else | |
| report_apps(app_names, bundle_ids) | |
| sig { override.returns(T::Boolean) } | |
| def run | |
| app_names, bundle_ids = load_apps | |
| test_bundle_id = args.named.first | |
| if test_bundle_id | |
| running = bundle_ids.include?(test_bundle_id) | |
| Homebrew.failed = true unless running | |
| running | |
| else | |
| report_apps(app_names, bundle_ids) | |
| true |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.