forked from KRTirtho/spotube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Windows memory leak due refetchOnStale user-liked-tracks (KRTirt…
…ho#705) * chore: refactor CLI stuff to separate service folder * chore: trying to fix memory leak * chore: fix fl_Query_devtools in wrong place * chore: upgrade deps * fix: user liked tracks memory leak due to isStale & updateQueryFn
- Loading branch information
Showing
10 changed files
with
206 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:args/args.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:package_info_plus/package_info_plus.dart'; | ||
import 'package:spotube/models/logger.dart'; | ||
|
||
Future<ArgResults> startCLI(List<String> args) async { | ||
final parser = ArgParser(); | ||
|
||
parser.addFlag( | ||
'verbose', | ||
abbr: 'v', | ||
help: 'Verbose mode', | ||
defaultsTo: !kReleaseMode, | ||
callback: (verbose) { | ||
if (verbose) { | ||
logEnv['VERBOSE'] = 'true'; | ||
logEnv['DEBUG'] = 'true'; | ||
logEnv['ERROR'] = 'true'; | ||
} | ||
}, | ||
); | ||
parser.addFlag( | ||
"version", | ||
help: "Print version and exit", | ||
negatable: false, | ||
); | ||
|
||
parser.addFlag("help", abbr: "h", negatable: false); | ||
|
||
final arguments = parser.parse(args); | ||
|
||
if (arguments["help"] == true) { | ||
print(parser.usage); | ||
exit(0); | ||
} | ||
|
||
if (arguments["version"] == true) { | ||
final package = await PackageInfo.fromPlatform(); | ||
print("Spotube v${package.version}"); | ||
exit(0); | ||
} | ||
|
||
return arguments; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.