mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 07:33:05 +00:00
add no-sync option
This commit is contained in:
parent
631f693d06
commit
6b14e8f881
4 changed files with 16 additions and 2 deletions
7
bin/mpw
7
bin/mpw
|
@ -37,6 +37,7 @@ I18n.locale = lang.to_sym
|
||||||
options = {}
|
options = {}
|
||||||
options[:force] = false
|
options[:force] = false
|
||||||
options[:format] = false
|
options[:format] = false
|
||||||
|
options[:sync] = true
|
||||||
options[:group] = nil
|
options[:group] = nil
|
||||||
options[:config] = nil
|
options[:config] = nil
|
||||||
|
|
||||||
|
@ -98,6 +99,10 @@ OptionParser.new do |opts|
|
||||||
options[:force] = true
|
options[:force] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('-N', '--no-sync', I18n.t('option.no_sync')) do
|
||||||
|
options[:sync] = false
|
||||||
|
end
|
||||||
|
|
||||||
opts.on('-G', '--generate-password [LENGTH]', I18n.t('option.generate_password')) do |length|
|
opts.on('-G', '--generate-password [LENGTH]', I18n.t('option.generate_password')) do |length|
|
||||||
puts MPW::MPW::password(length)
|
puts MPW::MPW::password(length)
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -126,7 +131,7 @@ elsif not config.check_gpg_key?
|
||||||
end
|
end
|
||||||
|
|
||||||
cli.decrypt
|
cli.decrypt
|
||||||
cli.sync
|
cli.sync(options[:sync])
|
||||||
|
|
||||||
# Display the item's informations
|
# Display the item's informations
|
||||||
if not options[:show].nil?
|
if not options[:show].nil?
|
||||||
|
|
|
@ -52,6 +52,7 @@ en:
|
||||||
type: "Data's type export file [csv|yaml]"
|
type: "Data's type export file [csv|yaml]"
|
||||||
import: "Import item since a yaml or csv file"
|
import: "Import item since a yaml or csv file"
|
||||||
force: "Force an action"
|
force: "Force an action"
|
||||||
|
no_sync: "Disable synchronization with the server"
|
||||||
format: "Change the display items format by an alternative format"
|
format: "Change the display items format by an alternative format"
|
||||||
generate_password: "Generate a random password (default 8 characters)"
|
generate_password: "Generate a random password (default 8 characters)"
|
||||||
help: "Show this help message"
|
help: "Show this help message"
|
||||||
|
|
|
@ -52,6 +52,7 @@ fr:
|
||||||
type: "Format des données du fichier d'export [csv|yaml]"
|
type: "Format des données du fichier d'export [csv|yaml]"
|
||||||
import: "Importe des éléments depuis un fichier yaml ou csv"
|
import: "Importe des éléments depuis un fichier yaml ou csv"
|
||||||
force: "Force une action, l'action ne demandera pas de confirmation"
|
force: "Force une action, l'action ne demandera pas de confirmation"
|
||||||
|
no_sync: "Désactive la synchronisation avec le serveur"
|
||||||
format: "Change le format d'affichage des éléments par un alternatif"
|
format: "Change le format d'affichage des éléments par un alternatif"
|
||||||
generate_password: "Génére un mot de passe aléatoire (défaut 8 caractères)"
|
generate_password: "Génére un mot de passe aléatoire (défaut 8 caractères)"
|
||||||
help: "Affiche ce message d'aide"
|
help: "Affiche ce message d'aide"
|
||||||
|
|
|
@ -23,8 +23,15 @@ class Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sync the data with the server
|
# Sync the data with the server
|
||||||
|
# @args: allow_sync -> allow or disable sync (boolean)
|
||||||
# @rtnr: true if the synchro is finish
|
# @rtnr: true if the synchro is finish
|
||||||
def sync
|
def sync(allow_sync=nil)
|
||||||
|
if not allow_sync.nil?
|
||||||
|
@allow_sync = allow_sync
|
||||||
|
end
|
||||||
|
|
||||||
|
return true if not @allow_sync
|
||||||
|
|
||||||
@sync = MPW::Sync.new(@config, @mpw, @password)
|
@sync = MPW::Sync.new(@config, @mpw, @password)
|
||||||
|
|
||||||
raise(@sync.error_msg) if not @sync.get_remote
|
raise(@sync.error_msg) if not @sync.get_remote
|
||||||
|
|
Loading…
Reference in a new issue