|
@@ -16,6 +16,9 @@ public static int main(string[] args) {
|
|
|
m_args.remove(1);
|
|
|
return manifest_main(m_args.to_array());
|
|
|
}
|
|
|
+ if(command == "info") {
|
|
|
+ return info(args);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
usage();
|
|
@@ -25,3 +28,52 @@ public static int main(string[] args) {
|
|
|
private void usage() {
|
|
|
printerr("USAGE:\n\tusm manifest\n");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+private int info(string[] args) throws Error {
|
|
|
+
|
|
|
+ if(args.length != 3) {
|
|
|
+ printerr("USAGE:\n\tusm info <path>\n");
|
|
|
+ return 255;
|
|
|
+ }
|
|
|
+
|
|
|
+ var path = args[2];
|
|
|
+
|
|
|
+ var file = File.new_build_filename(path);
|
|
|
+ if(!File.new_build_filename(path).query_exists()) {
|
|
|
+ print("The specified path does not exist\n");
|
|
|
+ return 200;
|
|
|
+ }
|
|
|
+
|
|
|
+ var type = "Unknown";
|
|
|
+ var file_info = file.query_info("*", FileQueryInfoFlags.NONE);
|
|
|
+ Usm.Manifest manifest = null;
|
|
|
+ if(file_info.get_file_type() == FileType.DIRECTORY) {
|
|
|
+ type = "Directory Structure";
|
|
|
+
|
|
|
+ var manifest_path = Path.build_filename(path, "MANIFEST.usm");
|
|
|
+ if(!File.new_build_filename(manifest_path).query_exists()) {
|
|
|
+ print("The directory contains no USM manifest file.\n");
|
|
|
+ return 201;
|
|
|
+ }
|
|
|
+
|
|
|
+ manifest = new Usm.Manifest.from_file(manifest_path);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ type = "USMC Package";
|
|
|
+ manifest = new Usm.Manifest.from_package(path);
|
|
|
+ }
|
|
|
+
|
|
|
+ print(@" Info for: \"$path\"\n");
|
|
|
+ print(@" Type: $type\n");
|
|
|
+ print(@" Name: $(manifest.name)\n");
|
|
|
+ print(@" Summary: $(manifest.summary)\n");
|
|
|
+ print(@" Version: $(manifest.version)\n");
|
|
|
+ print(@"Overall Licence Category: $(manifest.licences.min(l => l.category).category)\n");
|
|
|
+
|
|
|
+ foreach (var licence in manifest.licences.with_positions()) {
|
|
|
+ print(@" Licence $(licence.position): $(licence.item.name) ($(licence.item.category))\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|