From 6dedba9e3cedf6463f25460eba84111d6a0bd0dd Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 9 Jan 2026 23:48:17 +0800 Subject: Add command line wrapper for JVCS operations --- CommandLineWrapper/Constants.cs | 74 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 CommandLineWrapper/Constants.cs (limited to 'CommandLineWrapper/Constants.cs') 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"]; + } +} -- cgit