Skip to content

Commit fda5201

Browse files
committed
[ Edit ]
1 parent dd65532 commit fda5201

File tree

5 files changed

+22
-108
lines changed

5 files changed

+22
-108
lines changed

lib/src/command_runner.dart

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:langsync/src/commands/start_command/start_command.dart';
77
import 'package:langsync/src/etc/utils.dart';
88
import 'package:langsync/src/version.dart';
99
import 'package:mason_logger/mason_logger.dart';
10-
import 'package:pub_updater/pub_updater.dart';
1110

1211
const executableName = 'langsync';
1312
const packageName = 'langsync';
@@ -29,9 +28,7 @@ class LangsyncCommandRunner extends CompletionCommandRunner<int> {
2928
/// {@macro langsync_command_runner}
3029
LangsyncCommandRunner({
3130
Logger? logger,
32-
PubUpdater? pubUpdater,
3331
}) : _logger = logger ?? Logger(),
34-
_pubUpdater = pubUpdater ?? PubUpdater(),
3532
super(executableName, description) {
3633
// Add root options and flags
3734
argParser
@@ -58,7 +55,6 @@ class LangsyncCommandRunner extends CompletionCommandRunner<int> {
5855
void printUsage() => _logger.info(usage);
5956

6057
final Logger _logger;
61-
final PubUpdater _pubUpdater;
6258

6359
@override
6460
Future<int> run(Iterable<String> args) async {
@@ -124,30 +120,6 @@ class LangsyncCommandRunner extends CompletionCommandRunner<int> {
124120
exitCode = await super.runCommand(topLevelResults);
125121
}
126122

127-
// // Check for updates
128-
// if (topLevelResults.command?.name != UpdateCommand.commandName) {
129-
// await _checkForUpdates();
130-
// }
131-
132123
return exitCode;
133124
}
134-
135-
/// Checks if the current version (set by the build runner on the
136-
/// version.dart file) is the most recent one. If not, show a prompt to the
137-
/// user.
138-
Future<void> _checkForUpdates() async {
139-
try {
140-
final latestVersion = await _pubUpdater.getLatestVersion(packageName);
141-
final isUpToDate = packageVersion == latestVersion;
142-
if (!isUpToDate) {
143-
_logger
144-
..info('')
145-
..info(
146-
'''
147-
${lightYellow.wrap('Update available!')} ${lightCyan.wrap(packageVersion)} \u2192 ${lightCyan.wrap(latestVersion)}
148-
Run ${lightCyan.wrap('$executableName update')} to update''',
149-
);
150-
}
151-
} catch (_) {}
152-
}
153125
}

lib/src/commands/config_command/sub_commands/create_command.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ class ConfigCreateCommand extends Command<int> {
214214
..warn(
215215
'This error has been reported to the LangSync team, we will definitely look into it!',
216216
);
217-
} catch (e) {}
217+
} catch (e) {
218+
logger
219+
..info('\n')
220+
..warn(
221+
'This error could not be reported to the LangSync team, please report it manually, see https://docs.langsync.app/bug_report',
222+
);
223+
}
218224

219225
return ExitCode.software.code;
220226
}

lib/src/commands/start_command/start_command.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ class StartCommand extends Command<int> {
9797
..warn(
9898
'This error has been reported to the LangSync team, we will definitely look into it!',
9999
);
100-
} catch (e) {}
100+
} catch (e) {
101+
logger
102+
..info('\n')
103+
..warn(
104+
'This error could not be reported to the LangSync team, please report it manually, see https://docs.langsync.app/bug_report',
105+
);
106+
}
101107

102108
return ExitCode.config.code;
103109
}
@@ -172,7 +178,13 @@ class StartCommand extends Command<int> {
172178
..warn(
173179
'This error has been reported to the LangSync team, we will definitely look into it!',
174180
);
175-
} catch (e) {}
181+
} catch (e) {
182+
logger
183+
..info('\n')
184+
..warn(
185+
'This error could not be reported to the LangSync team, please report it manually, see https://docs.langsync.app/bug_report',
186+
);
187+
}
176188

177189
return ExitCode.software.code;
178190
}

lib/src/commands/update_command.dart

Lines changed: 0 additions & 75 deletions
This file was deleted.

pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ environment:
99

1010
dependencies:
1111
args: ^2.3.1
12-
cli_completion: ^0.3.0
12+
cli_completion: ^0.4.0
1313
equatable: ^2.0.5
1414
hive: ^2.2.3
1515
http: ^1.1.0
1616
mason_logger: ^0.2.4
1717
meta: ^1.11.0
1818
path: ^1.8.3
19-
pub_updater: ^0.3.0
2019
yaml: ^3.1.2
2120

2221
dev_dependencies:

0 commit comments

Comments
 (0)