From 1b27126a913dbfe98aef3f3427880ee648d3dc94 Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 9 Nov 2021 20:23:20 +0800 Subject: [PATCH] Revise help text again --- README.md | 33 ++++++++++++++++--------------- src/Settings.cpp | 51 +++++++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9dcf8dc..f89713b 100644 --- a/README.md +++ b/README.md @@ -32,30 +32,31 @@ Usage: nstool [options... ] -v, --verbose Verbose output. PFS0/HFS0 (PartitionFs), RomFs, NSP (Nintendo Submission Package) - nstool [--listfs] [--fsdir [] ] - --listfs Print file system. - -x, --fsdir Extract file system to directory. + nstool [--fstree] [-x [] ] + --fstree Print filesystem tree. + -x, --extract Extract a file or directory to local filesystem. XCI (GameCard Image) - nstool [--listfs] [--fsdir [] ] [--update --logo --normal --secure ] <.xci file> - --listfs Print file system. - -x, --fsdir Extract file system to directory. + nstool [--fstree] [-x [] ] <.xci file> + --fstree Print filesystem tree. + -x, --extract Extract a file or directory to local filesystem. --update Extract "update" partition to directory. (Alias for "-x /update ") --logo Extract "logo" partition to directory. (Alias for "-x /logo ") --normal Extract "normal" partition to directory. (Alias for "-x /normal ") --secure Extract "secure" partition to directory. (Alias for "-x /secure ") NCA (Nintendo Content Archive) - nstool [--listfs] [--bodykey --titlekey ] [--fsdir [] ] [--part0 ...] <.nca file> - --listfs Print file system. - -x, --fsdir Extract file system to directory. + nstool [--fstree] [-x [] ] [--bodykey --titlekey -tik ] <.nca file> + --fstree Print filesystem tree. + -x, --extract Extract a file or directory to local filesystem. --titlekey Specify title key extracted from ticket. + --bodykey Specify body encryption key. --tik Specify ticket to source title key. --cert Specify certificate chain to verify ticket. - --part0 Extract "partition 0" to directory. (Alias for "-x /0 ") - --part1 Extract "partition 1" to directory. (Alias for "-x /1 ") - --part2 Extract "partition 2" to directory. (Alias for "-x /2 ") - --part3 Extract "partition 3" to directory. (Alias for "-x /3 ") + --part0 Extract partition "0" to directory. (Alias for "-x /0 ") + --part1 Extract partition "1" to directory. (Alias for "-x /1 ") + --part2 Extract partition "2" to directory. (Alias for "-x /2 ") + --part3 Extract partition "3" to directory. (Alias for "-x /3 ") NSO (Nintendo Shared Object), NRO (Nintendo Relocatable Object) nstool [--listapi --listsym] [--insttype ] @@ -68,11 +69,11 @@ Usage: nstool [options... ] --kipdir Extract embedded Inital Programs to directory. ASET (Homebrew Asset Blob) - nstool [--listfs] [--icon --nacp --fsdir ] - --listfs Print filesystem in embedded RomFS partition. + nstool [--fstree] [-x [] ] [--icon --nacp ] + --fstree Print RomFS filesystem tree. + -x, --extract Extract a file or directory from RomFS to local filesystem. --icon Extract icon partition to file. --nacp Extract NACP partition to file. - -x, --fsdir Extract RomFS partition to directory. ``` # External Keys diff --git a/src/Settings.cpp b/src/Settings.cpp index a826a6c..7603e45 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -407,7 +407,17 @@ public: std::string custom_path_str; tc::io::PathUtil::pathToUnixUTF8(mCustomPath, custom_path_str); - fmt::print("[WARNING] \"{:s} {:s}\" is deprecated. Consider using \"-x {:s} {:s}\" instead.\n", option, params[0], custom_path_str, params[0]); + fmt::print("[WARNING] \"{:s} {:s}\" is deprecated. ", option, params[0]); + // if custom path is root path, use the shortened version of -x + if (mCustomPath == tc::io::Path("/")) + { + fmt::print("Consider using \"-x {:s}\" instead.\n", params[0]); + } + else + { + fmt::print("Consider using \"-x {:s} {:s}\" instead.\n", custom_path_str, params[0]); + } + mJobs.push_back({mCustomPath, tc::io::Path(params[0])}); } @@ -550,8 +560,9 @@ void nstool::SettingsInitializer::parse_args(const std::vector& arg opts.registerOptionHandler(std::shared_ptr(new InstructionTypeOptionHandler(code.is_64bit_instruction, { "--insttype" }))); // fs options - opts.registerOptionHandler(std::shared_ptr(new FlagOptionHandler(fs.show_fs_tree, { "--listfs" }))); - opts.registerOptionHandler(std::shared_ptr(new ExtractDataPathOptionHandler(fs.extract_jobs, { "--fsdir", "-x", "--extract" }))); + opts.registerOptionHandler(std::shared_ptr(new FlagOptionHandler(fs.show_fs_tree, { "--fstree", "--listfs" }))); + opts.registerOptionHandler(std::shared_ptr(new ExtractDataPathOptionHandler(fs.extract_jobs, { "-x", "--extract" }))); + opts.registerOptionHandler(std::shared_ptr(new CustomExtractDataPathOptionHandler(fs.extract_jobs, { "--fsdir" }, tc::io::Path("/")))); // xci options opts.registerOptionHandler(std::shared_ptr(new CustomExtractDataPathOptionHandler(fs.extract_jobs, { "--update" }, tc::io::Path("/update/")))); @@ -706,29 +717,29 @@ void nstool::SettingsInitializer::usage_text() const fmt::print(" --showlayout Show layout metadata.\n"); fmt::print(" -v, --verbose Verbose output.\n"); fmt::print("\n PFS0/HFS0 (PartitionFs), RomFs, NSP (Nintendo Submission Package)\n"); - fmt::print(" {:s} [--listfs] [--fsdir [] ] \n", BIN_NAME); - fmt::print(" --listfs Print file system.\n"); - fmt::print(" -x, --fsdir Extract file system to directory.\n"); + fmt::print(" {:s} [--fstree] [-x [] ] \n", BIN_NAME); + fmt::print(" --fstree Print filesystem tree.\n"); + fmt::print(" -x, --extract Extract a file or directory to local filesystem.\n"); fmt::print("\n XCI (GameCard Image)\n"); - fmt::print(" {:s} [--listfs] [--fsdir [] ] [--update --logo --normal --secure ] <.xci file>\n", BIN_NAME); - fmt::print(" --listfs Print file system.\n"); - fmt::print(" -x, --fsdir Extract file system to directory.\n"); + fmt::print(" {:s} [--fstree] [-x [] ] <.xci file>\n", BIN_NAME); + fmt::print(" --fstree Print filesystem tree.\n"); + fmt::print(" -x, --extract Extract a file or directory to local filesystem.\n"); fmt::print(" --update Extract \"update\" partition to directory. (Alias for \"-x /update \")\n"); fmt::print(" --logo Extract \"logo\" partition to directory. (Alias for \"-x /logo \")\n"); fmt::print(" --normal Extract \"normal\" partition to directory. (Alias for \"-x /normal \")\n"); fmt::print(" --secure Extract \"secure\" partition to directory. (Alias for \"-x /secure \")\n"); fmt::print("\n NCA (Nintendo Content Archive)\n"); - fmt::print(" {:s} [--listfs] [--bodykey --titlekey ] [--fsdir [] ] [--part0 ...] <.nca file>\n", BIN_NAME); - fmt::print(" --listfs Print file system.\n"); - fmt::print(" -x, --fsdir Extract file system to directory.\n"); + fmt::print(" {:s} [--fstree] [-x [] ] [--bodykey --titlekey -tik ] <.nca file>\n", BIN_NAME); + fmt::print(" --fstree Print filesystem tree.\n"); + fmt::print(" -x, --extract Extract a file or directory to local filesystem.\n"); fmt::print(" --titlekey Specify title key extracted from ticket.\n"); - //fmt::print(" --bodykey Specify body encryption key.\n"); + fmt::print(" --bodykey Specify body encryption key.\n"); fmt::print(" --tik Specify ticket to source title key.\n"); fmt::print(" --cert Specify certificate chain to verify ticket.\n"); - fmt::print(" --part0 Extract \"partition 0\" to directory. (Alias for \"-x /0 \")\n"); - fmt::print(" --part1 Extract \"partition 1\" to directory. (Alias for \"-x /1 \")\n"); - fmt::print(" --part2 Extract \"partition 2\" to directory. (Alias for \"-x /2 \")\n"); - fmt::print(" --part3 Extract \"partition 3\" to directory. (Alias for \"-x /3 \")\n"); + fmt::print(" --part0 Extract partition \"0\" to directory. (Alias for \"-x /0 \")\n"); + fmt::print(" --part1 Extract partition \"1\" to directory. (Alias for \"-x /1 \")\n"); + fmt::print(" --part2 Extract partition \"2\" to directory. (Alias for \"-x /2 \")\n"); + fmt::print(" --part3 Extract partition \"3\" to directory. (Alias for \"-x /3 \")\n"); fmt::print("\n NSO (Nintendo Shared Object), NRO (Nintendo Relocatable Object)\n"); fmt::print(" {:s} [--listapi --listsym] [--insttype ] \n", BIN_NAME); fmt::print(" --listapi Print SDK API List.\n"); @@ -738,11 +749,11 @@ void nstool::SettingsInitializer::usage_text() const fmt::print(" {:s} [--kipdir ] \n", BIN_NAME); fmt::print(" --kipdir Extract embedded Inital Programs to directory.\n"); fmt::print("\n ASET (Homebrew Asset Blob)\n"); - fmt::print(" {:s} [--listfs] [--icon --nacp --fsdir ] \n", BIN_NAME); - fmt::print(" --listfs Print filesystem in embedded RomFS partition.\n"); + fmt::print(" {:s} [--fstree] [-x [] ] [--icon --nacp ] \n", BIN_NAME); + fmt::print(" --fstree Print RomFS filesystem tree.\n"); + fmt::print(" -x, --extract Extract a file or directory from RomFS to local filesystem.\n"); fmt::print(" --icon Extract icon partition to file.\n"); fmt::print(" --nacp Extract NACP partition to file.\n"); - fmt::print(" -x, --fsdir Extract RomFS partition to directory.\n"); } void nstool::SettingsInitializer::dump_keys() const