-
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.
app command now shows version and description
- Loading branch information
1 parent
de8d258
commit fb10838
Showing
6 changed files
with
91 additions
and
7 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,32 @@ | ||
var pubspecContents = ''' | ||
name: apitest | ||
version: 0.1.1-alpha | ||
description: >- | ||
RICOH THETA WebAPI test implementation with Dart by Oppkey and the community. | ||
Based on RICOH THETA API v2.1 | ||
Direct questions to the community.theta360.guide. | ||
The WebAPI is usually used with mobile apps. This tool is a command line | ||
interface to a Dart library that can also be used with Flutter for iOS | ||
and Android. This command line tool can be put into bash scripts. | ||
dependencies: | ||
http: ^0.12.2 | ||
args: ^1.6.0 | ||
theta: | ||
git: | ||
url: https://github.com/codetricity/theta | ||
ref: main | ||
# change the path below to the path above for production use | ||
# path: ../theta | ||
dcli: ^0.41.0 | ||
yaml: ^2.2.1 | ||
path: ^1.7.0 | ||
environment: | ||
sdk: '>=2.10.0 <3.0.0' | ||
dev_dependencies: | ||
pedantic: ^1.0.0 | ||
repository: https://github.com/theta360developers/webapi | ||
homepage: https://theta360developers.github.io/webapi/ | ||
'''; |
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,48 @@ | ||
import 'package:args/command_runner.dart'; | ||
import 'dart:io'; | ||
import 'package:yaml/yaml.dart'; | ||
import 'package:path/path.dart' as p; | ||
|
||
// this does not work as the pubspec.yaml file is not distributed | ||
// with the theta.exe binary | ||
|
||
class AppCli extends Command { | ||
@override | ||
final name = 'app'; | ||
|
||
@override | ||
final description = 'information on this app. --version shows version'; | ||
|
||
AppCli() { | ||
argParser | ||
..addFlag('version', | ||
help: 'version information for this app', negatable: false) | ||
..addFlag('description', help: 'app description', negatable: false) | ||
..addFlag('repository', help: 'url of GitHub repo', negatable: false) | ||
..addFlag('homepage', help: 'blog for this tool', negatable: false); | ||
} | ||
|
||
@override | ||
void run() async { | ||
var pathToYaml = | ||
p.join(p.dirname(Platform.script.toFilePath()), '../pubspec.yaml'); | ||
var file = await File(pathToYaml); | ||
var yamlString = file.readAsStringSync(); | ||
var conf = loadYaml(yamlString); | ||
if (argResults.arguments.isEmpty) { | ||
printUsage(); | ||
} else if (argResults.wasParsed('version')) { | ||
print(conf['version']); | ||
} else if (argResults.wasParsed('description')) { | ||
print(conf['description']); | ||
} else if (argResults.wasParsed('repository')) { | ||
print(conf['repository']); | ||
} else if (argResults.wasParsed('homepage')) { | ||
print(conf['homepage']); | ||
} else { | ||
printUsage(); | ||
} | ||
|
||
exit(0); | ||
} | ||
} |
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
Binary file not shown.