refactor: commandline parsing

* `--rebase-todo-editor` launches this app as a git `sequence.editor`
* `--rebase-message-editor` launches this app as a git `core.editor` which runs on background by reading rebasing jobs
* `--core-editor` launches this app as a git `core.editor`
* `--askpass` launches this app as a SSH askpass program
This commit is contained in:
leo 2024-07-09 10:16:15 +08:00
parent cbe4c36525
commit 6930b51c64
No known key found for this signature in database
14 changed files with 320 additions and 155 deletions

View file

@ -28,21 +28,20 @@ namespace SourceGit.ViewModels
}
}
public Launcher(string[] commandlines)
public Launcher(string startupRepo)
{
Pages = new AvaloniaList<LauncherPage>();
AddNewTab();
if (commandlines.Length == 2)
if (!string.IsNullOrEmpty(startupRepo))
{
var path = commandlines[1];
var root = new Commands.QueryRepositoryRootPath(path).Result();
var root = new Commands.QueryRepositoryRootPath(startupRepo).Result();
if (string.IsNullOrEmpty(root))
{
Pages[0].Notifications.Add(new Notification
{
IsError = true,
Message = $"Given path: '{path}' is NOT a valid repository!"
Message = $"Given path: '{startupRepo}' is NOT a valid repository!"
});
return;
}