Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add a silent Install option via -s #4

Merged
merged 1 commit into from

2 participants

@mwrock

I'd like to create a chocolatey package for this and add it to my automated dev box builder and others might want to install via chocolatey as well which will nicely handle the dependency on mysgit 1.7.10.

@anurse anurse merged commit dcf6616 into from
@anurse
Owner

Finally got around to reviewing this. Thanks for being patient!

@mwrock

Thanks! I just added this as a Chocolatey package at http://chocolatey.org/packages/git-credential-winstore.

If you want to be added as a package owner, let me know your Chocolatey user name and I will add you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 21, 2012
  1. @mwrock
This page is out of date. Refresh to see the latest.
Showing with 38 additions and 21 deletions.
  1. +38 −21 git-credential-winstore/Program.cs
View
59 git-credential-winstore/Program.cs
@@ -24,7 +24,8 @@ class Program
static void Main(string[] args)
{
- TryLaunchDebugger(ref args);
+ TryLaunchDebugger(ref args);
+ if (TrySilentInstall(ref args)) { return; }
// Parse command
Func<IDictionary<string, string>, IEnumerable<Tuple<string, string>>> command = null;
@@ -61,6 +62,19 @@ private static void TryLaunchDebugger(ref string[] args)
Debugger.Launch();
args = args.Skip(1).ToArray();
}
+ }
+
+ private static bool TrySilentInstall(ref string[] args)
+ {
+ if (args.Length > 0 && args[0] == "-s")
+ {
+ Console.Out.WriteLine("Silently Installing...");
+ InstallTheApp(true);
+ args = args.Skip(1).ToArray();
+ return true;
+ }
+
+ return false;
}
private static void WriteGitParameters(IDictionary<string, string> response)
@@ -88,26 +102,29 @@ private static void WriteUsage()
Console.Error.WriteLine("If you see this. git-credential-winstore is correctly installed!");
Console.Error.WriteLine("This application is designed to be used by git as a credential helper and should not be invoked separately");
Console.Error.WriteLine("See the following link for more info: http://www.manpagez.com/man/1/git-credential-cache/");
- }
-
- private static void InstallTheApp()
- {
- if (MessageBox.Show("Do you want to install git-credential-winstore to prompt for passwords?",
- "Installing git-credential-winstore", MessageBoxButtons.YesNo) != DialogResult.Yes)
- {
- return;
- }
-
- var target = new DirectoryInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore"));
- if (!target.Exists)
- {
- target.Create();
- }
-
- var dest = new FileInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore\git-credential-winstore.exe"));
- File.Copy(Assembly.GetExecutingAssembly().Location, dest.FullName, true);
-
- Process.Start("git", "config --global credential.helper !~/AppData/Roaming/GitCredStore/git-credential-winstore");
+ }
+
+ private static void InstallTheApp(bool silent = false)
+ {
+ if(!silent)
+ {
+ if (MessageBox.Show("Do you want to install git-credential-winstore to prompt for passwords?",
+ "Installing git-credential-winstore", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ }
+
+ var target = new DirectoryInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore"));
+ if (!target.Exists)
+ {
+ target.Create();
+ }
+
+ var dest = new FileInfo(Environment.ExpandEnvironmentVariables(@"%AppData%\GitCredStore\git-credential-winstore.exe"));
+ File.Copy(Assembly.GetExecutingAssembly().Location, dest.FullName, true);
+
+ Process.Start("git", "config --global credential.helper !~/AppData/Roaming/GitCredStore/git-credential-winstore");
}
static IEnumerable<Tuple<string, string>> GetCommand(IDictionary<string, string> args)
Something went wrong with that request. Please try again.