Add help for sparklediff command and make it consistent with that of sparkleshare

This commit is contained in:
Hylke Bons 2010-07-03 19:33:42 +01:00
parent 51c6c4ec7c
commit 94226ed88c
2 changed files with 58 additions and 7 deletions

View file

@ -26,11 +26,43 @@ namespace SparkleShare {
public class SparkleDiff
{
// Short alias for the translations
public static string _ (string s)
{
return Catalog.GetString (s);
}
public static void Main (string [] args)
{
Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
// Check whether git is installed
Process Process = new Process ();
Process.StartInfo.FileName = "git";
Process.StartInfo.RedirectStandardOutput = true;
Process.StartInfo.UseShellExecute = false;
Process.Start ();
if (Process.StandardOutput.ReadToEnd ().IndexOf ("version") == -1) {
Console.WriteLine (_("Git wasn't found."));
Console.WriteLine (_("You can get Git from http://git-scm.com/."));
Environment.Exit (0);
}
// Don't allow running as root
UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName);
if (UnixUserInfo.UserId == 0) {
Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
Console.WriteLine (_("Things would go utterly wrong."));
Environment.Exit (0);
}
if (args.Length > 0) {
if (args [0].Equals ("--help") || args [0].Equals ("-h")) {
ShowHelp ();
Environment.Exit (0);
}
string file_path = args [0];
@ -56,6 +88,25 @@ namespace SparkleShare {
}
// Prints the help output
public static void ShowHelp ()
{
Console.WriteLine (_("SparkleDiff Copyright (C) 2010 Hylke Bons"));
Console.WriteLine (" ");
Console.WriteLine (_("This program comes with ABSOLUTELY NO WARRANTY."));
Console.WriteLine (_("This is free software, and you are welcome to redistribute it "));
Console.WriteLine (_("under certain conditions. Please read the GNU GPLv3 for details."));
Console.WriteLine (" ");
Console.WriteLine (_("SparkleDiff let's you compare revisions of an image file side by side."));
Console.WriteLine (" ");
Console.WriteLine (_("Usage: sparklediff [FILE]"));
Console.WriteLine (_("Open an image file to show its revisions"));
Console.WriteLine (" ");
Console.WriteLine (_("Arguments:"));
Console.WriteLine (_("\t -h, --help\t\tDisplay this help text."));
Console.WriteLine (" ");
}
}
@ -223,7 +274,7 @@ namespace SparkleShare {
private void SyncViewsVertically (object o, EventArgs args) {
Adjustment source_adjustment = (Adjustment) o;
if (source_adjustment == ViewLeft.ScrolledWindow.Vadjustment)
ViewRight.ScrolledWindow.Vadjustment = source_adjustment;
else
@ -315,7 +366,7 @@ namespace SparkleShare {
public Button ButtonPrevious;
public Button ButtonNext;
private int ValueCount;
// private int ValueCount;
private Image Image;
public RevisionView (string [] revisions) : base (false, 6)
@ -335,7 +386,7 @@ namespace SparkleShare {
ButtonPrevious = new Button (image_previous);
ButtonPrevious.Clicked += PreviousInComboBox;
ValueCount = 0;
// ValueCount = 0;
ComboBox = ComboBox.NewText ();
@ -345,7 +396,7 @@ namespace SparkleShare {
ComboBox.Active = 0;
ValueCount = revisions.Length;
// ValueCount = revisions.Length;
Image image_next = new Image ();
image_next.IconName = "go-next";

View file

@ -39,7 +39,7 @@ namespace SparkleShare {
// Use translations
Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
// Check if git is installed
// Check whether git is installed
Process Process = new Process ();
Process.StartInfo.FileName = "git";
Process.StartInfo.RedirectStandardOutput = true;
@ -56,7 +56,7 @@ namespace SparkleShare {
UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName);
if (UnixUserInfo.UserId == 0) {
Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
Console.WriteLine (_("Things will go utterly wrong."));
Console.WriteLine (_("Things would go utterly wrong."));
Environment.Exit (0);
}
@ -68,6 +68,7 @@ namespace SparkleShare {
HideUI = true;
if (Argument.Equals ("--help") || Argument.Equals ("-h")) {
ShowHelp ();
Environment.Exit (0);
}
}
}
@ -99,7 +100,6 @@ namespace SparkleShare {
Console.WriteLine (_("\t -d, --disable-gui\tDon't show the notification icon."));
Console.WriteLine (_("\t -h, --help\t\tDisplay this help text."));
Console.WriteLine (" ");
Environment.Exit (0);
}
}