diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-09 23:48:17 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-09 23:48:17 +0800 |
| commit | 6dedba9e3cedf6463f25460eba84111d6a0bd0dd (patch) | |
| tree | 4dcc6855ada5b28e20835ab60800c1028e505f7a /CommandLineWrapper/Constants.cs | |
| parent | 6b9268d2d88c81c18f2cc21e343d321989dad99c (diff) | |
Add command line wrapper for JVCS operations
Diffstat (limited to 'CommandLineWrapper/Constants.cs')
| -rw-r--r-- | CommandLineWrapper/Constants.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/CommandLineWrapper/Constants.cs b/CommandLineWrapper/Constants.cs new file mode 100644 index 0000000..91d0bd8 --- /dev/null +++ b/CommandLineWrapper/Constants.cs @@ -0,0 +1,74 @@ +namespace CommandLineWrapper; + +public static class Constants +{ + // Command line program path + public static FileInfo CommandLinePath => new FileInfo( + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, + OperatingSystem.IsWindows() ? "JustEnoughVCS.exe" : "JustEnoughVCS") + ); + + public static class CommandParameterGenerator + { + // Workspace Creation + public static string[] Initialize() => ["init"]; + public static string[] Create(string name) => ["create", name]; + + // Upstream Binding + public static string[] Login(string account, string upstream) => ["login", account, upstream, "-C"]; + public static string[] Direct(string upstream) => ["direct", upstream, "-C"]; + public static string[] Unstain() => ["unstain", "-C"]; + public static string[] Update() => ["update"]; + + // Account Management + public static string[] AccountAs(string account) => ["account", "as", account]; + public static string[] AccountAdd(string account) => ["account", "add", account]; + public static string[] AccountAddWithKey(string account) => ["account", "add", account, "--keygen"]; + public static string[] AccountMoveKey(string account, FileInfo privateKey) => ["account", "movekey", account, privateKey.ToString()]; + public static string[] AccountRemove(string account) => ["account", "remove", account]; + public static string[] AccountGeneratePublicKey(string account, DirectoryInfo directory) + => ["account", "genpub", account, directory.ToString()]; + + // Sheet Management + public static string[] SheetUse(string sheet) => ["sheet", "use", sheet]; + public static string[] SheetExit() => ["sheet", "exit"]; + public static string[] SheetSwitch(string sheet) => ["use", sheet]; + public static string[] SheetMake(string sheet) => ["sheet", "make", sheet, "-C"]; + public static string[] SheetDrop(string sheet) => ["sheet", "drop", sheet, "-C"]; + public static string[] SheetAlignOperation(string operationA, string operationB) => ["sheet", "align", operationA, operationB]; + + // Share + public static string[] Share(string mappingPattern, string sheet, string description) => ["share", mappingPattern, sheet, description]; + public static string[] ShareImportSafeMode(string shareId) => ["share", shareId, "--safe"]; + public static string[] ShareImportSkipMode(string shareId) => ["share", shareId, "--skip"]; + public static string[] ShareImportOverwriteMode(string shareId) => ["share", shareId, "--overwrite"]; + public static string[] ShareReject(string shareId) => ["share", shareId, "--reject"]; + + // File Operations + public static string[] Track(string mappingPattern) => ["track", mappingPattern]; + public static string[] TrackWithUpdate(string mappingPattern, string nextVersion, string description) + => ["track", mappingPattern, "--version", nextVersion, "--desc", description]; + public static string[] TrackAndOverwrite(string mappingPattern) + => ["track", mappingPattern, "--overwrite"]; + public static string[] Hold(string mappingPattern) => ["hold", mappingPattern]; + public static string[] Throw(string mappingPattern) => ["throw", mappingPattern]; + public static string[] TryHold(string mappingPattern) => ["hold", mappingPattern, "--skip-failed"]; + public static string[] TryThrow(string mappingPattern) => ["throw", mappingPattern, "--skip-failed"]; + public static string[] HoldUnchecked(string mappingPattern) => ["hold", mappingPattern, "--force"]; + public static string[] ThrowUnchecked(string mappingPattern) => ["throw", mappingPattern, "--force"]; + + // Informations + public static string[] Here() => ["here", "--json"]; + public static string[] Status() => ["status", "--json"]; + public static string[] Info(string mappingName) => ["info", mappingName, "--json"]; + public static string[] AccountList() => ["account", "list", "--json"]; + public static string[] SheetList() => ["sheet", "list", "--json"]; + public static string[] SheetAlignList() => ["sheet", "align", "--json"]; + public static string[] ShareList() => ["share", "list", "--json"]; + public static string[] ShareSee(string shareId) => ["share", "see", shareId, "--json"]; + public static string[] GetWorkspaceDirectory() => ["_workspace_dir"]; + public static string[] GetCurrentAccount() => ["_account"]; + public static string[] GetCurrentUpstream() => ["_upstream"]; + public static string[] GetCurrentSheet() => ["_sheet"]; + } +} |
