Skip to content

Commit

Permalink
Check if MacUpdater CLI is available
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorgalvao committed Oct 29, 2021
1 parent bce837a commit 00fce09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Workflow Environment Variables:
<string></string>
</dict>
<key>version</key>
<string>2021.1</string>
<string>2021.2</string>
<key>webaddress</key>
<string>https://corecode.io/macupdater/</string>
</dict>
Expand Down
13 changes: 12 additions & 1 deletion source/macupdater
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,19 @@ def get_env(variable:, default:, as_bool: false, as_pathname: false, match_list:
end

def get_outdated(mu_cli, hide_non_updatable)
all = JSON.parse(Open3.capture2(mu_cli.to_path, 'list', '--json', '--hide-uptodate-apps').first)['apps']
command = Open3.capture2(mu_cli.to_path, 'list', '--json', '--hide-uptodate-apps')

if command[1].exitstatus == 255
puts({ items: [{
title: 'Requires MacUpdater Pro or Business License',
subtitle: 'This Workflow depends on the command-line tool, not available in Standard',
valid: false
}] }.to_json)

exit 1
end

all = JSON.parse(command.first)['apps']
return all.select { |app| app['auto_updatable'] } if hide_non_updatable

all
Expand Down

0 comments on commit 00fce09

Please sign in to comment.