-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rfw_tools, need to move rfw2txt, txt2rfw to single tools package
- Loading branch information
Showing
12 changed files
with
514 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ |
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,3 @@ | ||
## 1.0.0 | ||
|
||
- Initial version. |
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 @@ | ||
A sample command-line application providing basic argument parsing with an entrypoint in `bin/`. |
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,30 @@ | ||
# This file configures the static analysis results for your project (errors, | ||
# warnings, and lints). | ||
# | ||
# This enables the 'recommended' set of lints from `package:lints`. | ||
# This set helps identify many issues that may lead to problems when running | ||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic | ||
# style and format. | ||
# | ||
# If you want a smaller set of lints you can change this to specify | ||
# 'package:lints/core.yaml'. These are just the most critical lints | ||
# (the recommended set includes the core lints). | ||
# The core lints are also what is used by pub.dev for scoring packages. | ||
|
||
include: package:lints/recommended.yaml | ||
|
||
# Uncomment the following section to specify additional rules. | ||
|
||
# linter: | ||
# rules: | ||
# - camel_case_types | ||
|
||
# analyzer: | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
|
||
# For more information about the core and recommended set of lints, see | ||
# https://dart.dev/go/core-lints | ||
|
||
# For additional information about configuring this file, see | ||
# https://dart.dev/guides/language/analysis-options |
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,3 @@ | ||
void main() { | ||
print('rfw2txt cli'); | ||
} |
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,61 @@ | ||
import 'package:args/args.dart'; | ||
|
||
const String version = '0.0.1'; | ||
|
||
ArgParser buildParser() { | ||
return ArgParser() | ||
..addFlag( | ||
'help', | ||
abbr: 'h', | ||
negatable: false, | ||
help: 'Print this usage information.', | ||
) | ||
..addFlag( | ||
'verbose', | ||
abbr: 'v', | ||
negatable: false, | ||
help: 'Show additional command output.', | ||
) | ||
..addFlag( | ||
'version', | ||
negatable: false, | ||
help: 'Print the tool version.', | ||
); | ||
} | ||
|
||
void printUsage(ArgParser argParser) { | ||
print('Usage: dart rfw_tools.dart <flags> [arguments]'); | ||
print(argParser.usage); | ||
} | ||
|
||
void main(List<String> arguments) { | ||
final ArgParser argParser = buildParser(); | ||
try { | ||
final ArgResults results = argParser.parse(arguments); | ||
bool verbose = false; | ||
|
||
// Process the parsed arguments. | ||
if (results.wasParsed('help')) { | ||
printUsage(argParser); | ||
return; | ||
} | ||
if (results.wasParsed('version')) { | ||
print('rfw_tools version: $version'); | ||
return; | ||
} | ||
if (results.wasParsed('verbose')) { | ||
verbose = true; | ||
} | ||
|
||
// Act on the arguments provided. | ||
print('Positional arguments: ${results.rest}'); | ||
if (verbose) { | ||
print('[VERBOSE] All arguments: ${results.arguments}'); | ||
} | ||
} on FormatException catch (e) { | ||
// Print usage information if an invalid argument was provided. | ||
print(e.message); | ||
print(''); | ||
printUsage(argParser); | ||
} | ||
} |
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,3 @@ | ||
void main() { | ||
print('txt2rfw cli'); | ||
} |
Empty file.
Oops, something went wrong.