updated SibaCLI
This commit is contained in:
parent
8b208a14e0
commit
8a6ddad2fb
@ -1,4 +1,14 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
File diff suppressed because one or more lines are too long
BIN
lib/Siba.jar
BIN
lib/Siba.jar
Binary file not shown.
@ -35,12 +35,12 @@ public class Siba
|
|||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
SibaGUI.main(args);
|
SibaGUI.run(args);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SibaCLI.main(args);
|
SibaCLI.run(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ import org.dclermonte.siba.model.SibaManager;
|
|||||||
|
|
||||||
public class SibaCLI
|
public class SibaCLI
|
||||||
{
|
{
|
||||||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.cli.messages"); //$NON-NLS-1$
|
||||||
|
|
||||||
public static void backup(final File directoryToSave, final String targetDirectory)
|
public static void backup(final File directoryToSave, final File targetDirectory)
|
||||||
throws ArchiveException, IOException
|
throws ArchiveException, IOException
|
||||||
{
|
{
|
||||||
File result;
|
File result;
|
||||||
result = SibaManager.backup(directoryToSave, targetDirectory);
|
result = SibaManager.backup(directoryToSave, targetDirectory);
|
||||||
System.out.println(BUNDLE.getString("BackupPanel.confirmDialogMessage.text") + result.getName());
|
System.out.println(BUNDLE.getString("confirmDialog.text") + result.getName()); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +46,9 @@ public class SibaCLI
|
|||||||
{
|
{
|
||||||
boolean result;
|
boolean result;
|
||||||
result = SibaManager.check(fileToCheck);
|
result = SibaManager.check(fileToCheck);
|
||||||
String yourFile = BUNDLE.getString("CheckPanel.confirmDialogYourString.text");
|
String yourFile = BUNDLE.getString("confirmDialogYourString.text"); //$NON-NLS-1$
|
||||||
String good = BUNDLE.getString("CheckPanel.confirmDialogGood.text");
|
String good = BUNDLE.getString("confirmDialogGood.text"); //$NON-NLS-1$
|
||||||
String bad = BUNDLE.getString("CheckPanel.confirmDialogBad.text");
|
String bad = BUNDLE.getString("confirmDialogBad.text"); //$NON-NLS-1$
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
System.out.println(yourFile + fileToCheck.getName() + good);
|
System.out.println(yourFile + fileToCheck.getName() + good);
|
||||||
@ -63,69 +63,125 @@ public class SibaCLI
|
|||||||
public static void help()
|
public static void help()
|
||||||
{
|
{
|
||||||
|
|
||||||
System.out.println("usage : ");
|
System.out.println("usage :");
|
||||||
System.out.println("Siba : ");
|
System.out.println("Siba :");
|
||||||
System.out.println("Siba [-h |-help| --help]");
|
System.out.println("Siba [-h |-help| --help]");
|
||||||
System.out.println("siba -backup directoryToSave [-target]");
|
System.out.println("siba backup directoryToSave [target]");
|
||||||
System.out.println("siba -check [filename | file.tgz | file.md5]");
|
System.out.println("siba check [filename | filename.tgz | filename.tgz.md5]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(final String[] args) throws ArchiveException, IOException, NoSuchAlgorithmException
|
public static void run(final String[] args) throws ArchiveException, IOException, NoSuchAlgorithmException
|
||||||
{
|
{
|
||||||
|
|
||||||
int numberParameter = args.length;
|
int numberParameter = args.length;
|
||||||
switch (numberParameter)
|
if (numberParameter == 0)
|
||||||
{
|
{
|
||||||
case 0:
|
SibaGUI.run(args);
|
||||||
SibaGUI.main(args);
|
}
|
||||||
break;
|
else
|
||||||
case 1:
|
{
|
||||||
|
|
||||||
|
if ((args[0].equals("-h")) || (args[0].equals("-help")) || (args[0].equals("--help")))
|
||||||
|
{
|
||||||
help();
|
help();
|
||||||
break;
|
}
|
||||||
case 2:
|
else if (args[0].equals("backup"))
|
||||||
if (args[0].equals("-backup"))
|
{
|
||||||
|
|
||||||
|
if (numberParameter == 1)
|
||||||
|
{
|
||||||
|
System.out.println(BUNDLE.getString("missingDirectoryToSave.text"));
|
||||||
|
help();
|
||||||
|
}
|
||||||
|
else if (numberParameter == 2)
|
||||||
{
|
{
|
||||||
File directoryToSave = new File(args[1]);
|
File directoryToSave = new File(args[1]);
|
||||||
if (directoryToSave.exists())
|
if (directoryToSave.exists())
|
||||||
|
{
|
||||||
|
backup(directoryToSave, new File(System.getProperty("user.dir")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println(BUNDLE.getString("directoryToSaveNotExist.text"));
|
||||||
|
help();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (numberParameter == 3)
|
||||||
|
{
|
||||||
|
File directoryToSave = new File(args[1]);
|
||||||
|
File targetDirectory = new File(args[2]);
|
||||||
|
if (directoryToSave.exists() && targetDirectory.exists())
|
||||||
|
{
|
||||||
|
backup(directoryToSave, targetDirectory);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println(BUNDLE.getString("directoryNotExist.text"));
|
||||||
|
help();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println(BUNDLE.getString("badUsage.text"));
|
||||||
|
help();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (args[0].equals("check"))
|
||||||
|
{
|
||||||
|
if (numberParameter == 1)
|
||||||
|
{
|
||||||
|
System.out.println(BUNDLE.getString("missingFileToCheck.text"));
|
||||||
|
help();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String fileToCheckName = args[1];
|
||||||
|
if (!args[1].endsWith("tgz") && !args[1].endsWith("md5"))
|
||||||
|
{
|
||||||
|
fileToCheckName = fileToCheckName.concat(".tgz.md5");
|
||||||
|
}
|
||||||
|
else if (args[1].endsWith("tgz"))
|
||||||
|
{
|
||||||
|
fileToCheckName = fileToCheckName.concat(".md5");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileToCheckName = args[1];
|
||||||
|
}
|
||||||
|
File fileToCheck = new File(fileToCheckName);
|
||||||
|
File fileToCheckFinal;
|
||||||
|
if (!fileToCheck.isAbsolute())
|
||||||
|
{
|
||||||
|
fileToCheckFinal = new File(System.getProperty("user.dir") + "/" + fileToCheckName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileToCheckFinal = new File(fileToCheckName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileToCheckFinal.exists())
|
||||||
{
|
{
|
||||||
|
|
||||||
backup(directoryToSave, directoryToSave.getParent());
|
check(fileToCheckFinal);
|
||||||
System.out.println(BUNDLE.getString("BackupPanel.parentDirectory.text"));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
if (args[0].equals("-check"))
|
|
||||||
{
|
|
||||||
File fileToCheck = new File(args[1]);
|
|
||||||
if (fileToCheck.exists())
|
|
||||||
{
|
{
|
||||||
check(fileToCheck);
|
System.out.println(BUNDLE.getString("missingFileToCheck.text"));
|
||||||
return;
|
help();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
help();
|
{
|
||||||
}
|
System.out.println(BUNDLE.getString("badUsage.text"));
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (args[0].equals("-backup"))
|
|
||||||
{
|
|
||||||
File directoryToSave = new File(args[1]);
|
|
||||||
if (directoryToSave.exists())
|
|
||||||
{
|
|
||||||
backup(directoryToSave, args[2]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
help();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
help();
|
help();
|
||||||
break;
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/org/dclermonte/siba/cli/messages.properties
Normal file
9
src/org/dclermonte/siba/cli/messages.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
confirmDialog.text=Your directory has been backup \n in the file :\n
|
||||||
|
confirmDialogYourString.text=Your File
|
||||||
|
confirmDialogGood.text=has been check and is good
|
||||||
|
confirmDialogBad.text = is corrupted
|
||||||
|
badUsage.text = Bad usage
|
||||||
|
missingDirectoryToSave.text = Missing the directory to backup
|
||||||
|
directoryToSaveNotExist.text = The directory to save do not exist
|
||||||
|
directoryNotExist.text = one of the directories does not exist
|
||||||
|
missingFileToCheck.text = Missing the file to check
|
9
src/org/dclermonte/siba/cli/messages_fr_FR.properties
Normal file
9
src/org/dclermonte/siba/cli/messages_fr_FR.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
confirmDialog.text = Votre répertoire a été sauvegardé \n dans le fichier :\n
|
||||||
|
confirmDialogYourString.text=Votre fichier
|
||||||
|
confirmDialogGood.text=a été vérifié et ne comporte pas d'erreurs
|
||||||
|
confirmDialogBad.text = comporte des erreurs
|
||||||
|
badUsage.text = mauvais usage
|
||||||
|
missingDirectoryToSave.text = Il manque le répertoire à sauvegarder
|
||||||
|
directoryToSaveNotExist.text = Le répertoire à sauvegarder n'existe pas
|
||||||
|
directoryNotExist.text = L'un des répertoires n'existe pas
|
||||||
|
missingFileToCheck.text = Il manque le fichier à vérifier
|
@ -176,7 +176,7 @@ public class BackupPanel extends JPanel
|
|||||||
File targetDirectory = new File(BackupPanel.this.textField_1.getText());
|
File targetDirectory = new File(BackupPanel.this.textField_1.getText());
|
||||||
if (directoryToSave1.exists() && targetDirectory.exists())
|
if (directoryToSave1.exists() && targetDirectory.exists())
|
||||||
{
|
{
|
||||||
File output1 = SibaManager.backup(directoryToSave1, BackupPanel.this.textField_1.getText());
|
File output1 = SibaManager.backup(directoryToSave1, targetDirectory);
|
||||||
|
|
||||||
String message = BUNDLE.getString("BackupPanel.confirmDialogMessage.text") + output1.getName();
|
String message = BUNDLE.getString("BackupPanel.confirmDialogMessage.text") + output1.getName();
|
||||||
String titre = BUNDLE.getString("BackupPanel.confirmDialogTitle.text");
|
String titre = BUNDLE.getString("BackupPanel.confirmDialogTitle.text");
|
||||||
|
@ -50,7 +50,7 @@ public class SibaGUI
|
|||||||
{
|
{
|
||||||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||||
|
|
||||||
public static void main(final String[] args)
|
public static void run(final String[] args)
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -28,4 +28,3 @@ CheckPanel.confirmDialogGood.text = has been check and is good
|
|||||||
CheckPanel.confirmDialogBad.text = is corrupted
|
CheckPanel.confirmDialogBad.text = is corrupted
|
||||||
BackupPanel.dataMissing.text = Data Missing
|
BackupPanel.dataMissing.text = Data Missing
|
||||||
BackupPanel.TitleWarning.text = Warning
|
BackupPanel.TitleWarning.text = Warning
|
||||||
BackupPanel.parentDirectory.text= Your backup File is in the parent directory
|
|
@ -28,4 +28,3 @@ CheckPanel.confirmDialogGood.text = a
|
|||||||
CheckPanel.confirmDialogBad.text = comporte des erreurs
|
CheckPanel.confirmDialogBad.text = comporte des erreurs
|
||||||
BackupPanel.dataMissing.text = Données incomplètes
|
BackupPanel.dataMissing.text = Données incomplètes
|
||||||
BackupPanel.TitleWarning.text = Attention
|
BackupPanel.TitleWarning.text = Attention
|
||||||
BackupPanel.parentDirectory.text= Votre fichier de sauvegarde est dans le répertoire parent
|
|
@ -41,7 +41,7 @@ import org.apache.commons.compress.utils.IOUtils;
|
|||||||
public class SibaManager
|
public class SibaManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public static File backup(final File fileToSave, final String target) throws ArchiveException, IOException
|
public static File backup(final File fileToSave, final File target) throws ArchiveException, IOException
|
||||||
{
|
{
|
||||||
File result;
|
File result;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user