mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
added delete-config sub command
This commit is contained in:
@@ -118,6 +118,15 @@ public class ScmClientConfig
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
public void delete()
|
||||
{
|
||||
fileHandler.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -101,9 +101,7 @@ public class ScmClientConfigFileHandler
|
||||
*/
|
||||
public ScmClientConfigFileHandler()
|
||||
{
|
||||
Preferences prefs =
|
||||
Preferences.userNodeForPackage(ScmClientConfigFileHandler.class);
|
||||
|
||||
prefs = Preferences.userNodeForPackage(ScmClientConfigFileHandler.class);
|
||||
key = prefs.get(PREF_SECRET_KEY, null);
|
||||
|
||||
if (Util.isEmpty(key))
|
||||
@@ -125,6 +123,22 @@ public class ScmClientConfigFileHandler
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
public void delete()
|
||||
{
|
||||
File configFile = getConfigFile();
|
||||
|
||||
if (configFile.exists() &&!configFile.delete())
|
||||
{
|
||||
throw new ScmConfigException("could not delete config file");
|
||||
}
|
||||
|
||||
prefs.remove(PREF_SECRET_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -286,4 +300,7 @@ public class ScmClientConfigFileHandler
|
||||
|
||||
/** Field description */
|
||||
private String key;
|
||||
|
||||
/** Field description */
|
||||
private Preferences prefs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user