Skip to content

Commit

Permalink
✏️ Don't mix update and upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Mar 19, 2022
1 parent 1f59679 commit 20fed7f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final AlfredUpdater updater = AlfredUpdater(
updateInterval: Duration(days: 7),
);
bool verbose = false;
bool upgrade = false;
bool update = false;

void main(List<String> arguments) async {
try {
Expand All @@ -46,12 +46,12 @@ void main(List<String> arguments) async {
final ArgParser parser = ArgParser()
..addOption('query', abbr: 'q', defaultsTo: '')
..addFlag('verbose', abbr: 'v', defaultsTo: false)
..addFlag('upgrade', abbr: 'u', defaultsTo: false);
..addFlag('update', abbr: 'u', defaultsTo: false);
final ArgResults args = parser.parse(arguments);

upgrade = args['upgrade'];
if (upgrade) {
stdout.writeln('Upgrading workflow...');
update = args['update'];
if (update) {
stdout.writeln('Updating workflow...');

return await updater.update();
}
Expand All @@ -78,17 +78,17 @@ void main(List<String> arguments) async {
workflow.addItem(AlfredItem(title: err.toString()));
if (verbose) rethrow;
} finally {
if (!upgrade) {
if (!update) {
if (await updater.updateAvailable()) {
workflow.run(addToBeginning: upgradeItem);
workflow.run(addToBeginning: updateItem);
} else {
workflow.run();
}
}
}
}

const upgradeItem = AlfredItem(
const updateItem = AlfredItem(
title: 'Auto-Update available!',
subtitle: 'Press <enter> to auto-update to a new version of this workflow.',
arg: 'update:workflow',
Expand Down
2 changes: 1 addition & 1 deletion bin/src/constants/config.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Config {
Config._();

static const String version = '1.0.3';
static const String version = '1.0.4';
static final Uri githubRepositoryUrl =
Uri.https('github.com', '/techouse/alfred-gitmoji');
static const String algoliaApplicationId = 'WODHKE4WZG';
Expand Down
4 changes: 2 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>./gm --upgrade</string>
<string>./gm -u</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -251,7 +251,7 @@
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>1.0.3</string>
<string>1.0.4</string>
<key>webaddress</key>
<string>https://github.com/techouse</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Search for gitmojis and copy them to the clipboard easily.
# Prevent accidental publishing to pub.dev.
publish_to: 'none'

version: 1.0.3
version: 1.0.4

environment:
sdk: '>=2.16.1 <3.0.0'
Expand Down

0 comments on commit 20fed7f

Please sign in to comment.