1 // ArchiveCommandLine.h 2 3 #ifndef __ARCHIVE_COMMAND_LINE_H 4 #define __ARCHIVE_COMMAND_LINE_H 5 6 #include "../../../Common/CommandLineParser.h" 7 #include "../../../Common/Wildcard.h" 8 9 #include "EnumDirItems.h" 10 11 #include "Extract.h" 12 #include "HashCalc.h" 13 #include "Update.h" 14 15 typedef CMessagePathException CArcCmdLineException; 16 17 namespace NCommandType { enum EEnum 18 { 19 kAdd = 0, 20 kUpdate, 21 kDelete, 22 kTest, 23 kExtract, 24 kExtractFull, 25 kList, 26 kBenchmark, 27 kInfo, 28 kHash, 29 kRename 30 };} 31 32 struct CArcCommand 33 { 34 NCommandType::EEnum CommandType; 35 36 bool IsFromExtractGroup() const; 37 bool IsFromUpdateGroup() const; IsTestCommandCArcCommand38 bool IsTestCommand() const { return CommandType == NCommandType::kTest; } 39 NExtract::NPathMode::EEnum GetPathMode() const; 40 }; 41 42 enum 43 { 44 k_OutStream_disabled = 0, 45 k_OutStream_stdout = 1, 46 k_OutStream_stderr = 2 47 }; 48 49 struct CArcCmdLineOptions 50 { 51 bool HelpMode; 52 53 // bool LargePages; 54 bool CaseSensitive_Change; 55 bool CaseSensitive; 56 57 bool IsInTerminal; 58 bool IsStdOutTerminal; 59 bool IsStdErrTerminal; 60 bool StdInMode; 61 bool StdOutMode; 62 bool EnableHeaders; 63 64 bool YesToAll; 65 bool ShowDialog; 66 bool TechMode; 67 bool ShowTime; 68 69 AString ListFields; 70 71 int ConsoleCodePage; 72 73 NWildcard::CCensor Censor; 74 75 CArcCommand Command; 76 UString ArchiveName; 77 78 #ifndef _NO_CRYPTO 79 bool PasswordEnabled; 80 UString Password; 81 #endif 82 83 UStringVector HashMethods; 84 // UString HashFilePath; 85 86 bool AppendName; 87 // UStringVector ArchivePathsSorted; 88 // UStringVector ArchivePathsFullSorted; 89 NWildcard::CCensor arcCensor; 90 UString ArcName_for_StdInMode; 91 92 CObjectVector<CProperty> Properties; 93 94 CExtractOptionsBase ExtractOptions; 95 96 CBoolPair NtSecurity; 97 CBoolPair AltStreams; 98 CBoolPair HardLinks; 99 CBoolPair SymLinks; 100 101 CBoolPair StoreOwnerId; 102 CBoolPair StoreOwnerName; 103 104 CUpdateOptions UpdateOptions; 105 CHashOptions HashOptions; 106 UString ArcType; 107 UStringVector ExcludedArcTypes; 108 109 unsigned Number_for_Out; 110 unsigned Number_for_Errors; 111 unsigned Number_for_Percents; 112 unsigned LogLevel; 113 114 // bool IsOutAllowed() const { return Number_for_Out != k_OutStream_disabled; } 115 116 // Benchmark 117 UInt32 NumIterations; 118 bool NumIterations_Defined; 119 CArcCmdLineOptionsCArcCmdLineOptions120 CArcCmdLineOptions(): 121 HelpMode(false), 122 // LargePages(false), 123 CaseSensitive_Change(false), 124 CaseSensitive(false), 125 126 IsInTerminal(false), 127 IsStdOutTerminal(false), 128 IsStdErrTerminal(false), 129 130 StdInMode(false), 131 StdOutMode(false), 132 133 EnableHeaders(false), 134 135 YesToAll(false), 136 ShowDialog(false), 137 TechMode(false), 138 ShowTime(false), 139 140 ConsoleCodePage(-1), 141 142 Number_for_Out(k_OutStream_stdout), 143 Number_for_Errors(k_OutStream_stderr), 144 Number_for_Percents(k_OutStream_stdout), 145 146 LogLevel(0) 147 { 148 }; 149 }; 150 151 class CArcCmdLineParser 152 { 153 NCommandLineParser::CParser parser; 154 public: 155 UString Parse1Log; 156 void Parse1(const UStringVector &commandStrings, CArcCmdLineOptions &options); 157 void Parse2(CArcCmdLineOptions &options); 158 }; 159 160 #endif 161