1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-03-19 12:59:30 +00:00

enable sync

This commit is contained in:
Adrien Waksberg 2016-10-23 22:39:22 +02:00
parent 90e8b658bf
commit 5bcf26d251
10 changed files with 52 additions and 20 deletions

View file

@ -24,7 +24,8 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
options = {}
options[:sync] = true
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
@ -38,6 +39,10 @@ OptionParser.new do |opts|
exit 0
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-r', '--random', I18n.t('option.random_password')) do
options[:password] = true
end

View file

@ -65,9 +65,9 @@ config = MPW::Config.new(options[:config])
cli = MPW::Cli.new(config, nil)
if not options[:init].nil?
cli.setup(values)
cli.load_config
cli.get_wallet
cli.setup(values)
cli.setup_gpg_key(options[:init])
cli.setup_wallet_config
else

View file

@ -24,7 +24,8 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
options = {}
options[:sync] = true
options[:clipboard] = true
values = {}

View file

@ -24,8 +24,9 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
values = {}
options = {}
options[:sync] = true
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw delete [options]"
@ -43,6 +44,10 @@ OptionParser.new do |opts|
exit 0
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
values[:pattern] = pattern
end

View file

@ -24,8 +24,9 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
values = {}
options = {}
options[:sync] = true
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
@ -47,6 +48,10 @@ OptionParser.new do |opts|
exit 0
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
values[:pattern] = pattern
end

View file

@ -24,7 +24,8 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
options = {}
options[:sync] = true
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw import [options]"
@ -42,6 +43,10 @@ OptionParser.new do |opts|
exit 0
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
options[:wallet] = wallet
end
@ -50,10 +55,6 @@ end.parse!
config = MPW::Config.new(options[:config])
cli = MPW::Cli.new(config, options[:sync])
opts = { search: options[:pattern],
group: options[:group],
}
cli.load_config
cli.get_wallet(options[:wallet])
cli.decrypt

View file

@ -24,8 +24,9 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
values = {}
options = {}
options[:sync] = true
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw list [options]"
@ -47,6 +48,10 @@ OptionParser.new do |opts|
values[:pattern] = pattern
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
options[:wallet] = wallet
end

View file

@ -24,8 +24,9 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
values = {}
options = {}
options[:sync] = true
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw update [options]"
@ -43,6 +44,10 @@ OptionParser.new do |opts|
exit 0
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
values[:pattern] = pattern
end

View file

@ -24,8 +24,9 @@ require 'mpw/cli'
# Options
# --------------------------------------------------------- #
options = {}
values = {}
options = {}
options[:sync] = {}
values = {}
OptionParser.new do |opts|
opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
@ -47,6 +48,10 @@ OptionParser.new do |opts|
options[:list] = true
end
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
options[:sync] = false
end
opts.on('--password', I18n.t('option.password')) do
values[:password] = true
end

View file

@ -289,10 +289,10 @@ class MPW
case @config['protocol']
when 'sftp', 'scp', 'ssh'
require "mpw/sync/ssh"
sync = SyncSSH.new(@config['sync'])
sync = SyncSSH.new(@config)
when 'ftp'
require 'mpw/sync/ftp'
sync = SyncFTP.new(@config['sync'])
sync = SyncFTP.new(@config)
else
raise I18n.t('error.sync.unknown_type')
end