-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add URL open and change icons [release]
- Loading branch information
Showing
7 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using AddActionsWorkflow.Options; | ||
using CliWrap; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AddActionsWorkflow.Commands | ||
{ | ||
[Command(PackageIds.LaunchRemoteUrlCommand)] | ||
internal class LaunchRemoteUrlCommand : BaseCommand<LaunchRemoteUrlCommand> | ||
{ | ||
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) | ||
{ | ||
// get the repo URI | ||
var dirInfo = new DirectoryInfo((await VS.Solutions.GetCurrentSolutionAsync()).FullPath); | ||
var slnDir = dirInfo.Parent.FullName; | ||
|
||
var stdOutBuffer = new StringBuilder(); | ||
var stdErrBuffer = new StringBuilder(); | ||
|
||
var result = await Cli.Wrap("git") | ||
.WithArguments("remote get-url origin --push") | ||
.WithWorkingDirectory(slnDir) | ||
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer)) | ||
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer)) | ||
.WithValidation(CommandResultValidation.None) | ||
.ExecuteAsync(); | ||
|
||
var stdOut = stdOutBuffer.ToString(); | ||
var stdErr = stdErrBuffer.ToString(); | ||
|
||
if (result.ExitCode == 0) | ||
{ | ||
_ = Process.Start(stdOut); | ||
} | ||
else | ||
{ | ||
var argError = new UriFormatException(stdErr); | ||
await argError.LogAsync(); | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters