feat: add copy url

This commit is contained in:
Adrien Waksberg 2017-05-21 18:00:43 +02:00
parent 5f29f7b6e8
commit ab459f954d
3 changed files with 13 additions and 0 deletions

View file

@ -111,8 +111,10 @@ en:
login: "The login has been copied in clipboard." login: "The login has been copied in clipboard."
password: "The password has been copied in clipboard for 30s!" password: "The password has been copied in clipboard for 30s!"
otp: "The OTP code has been copied for %{time}s!" otp: "The OTP code has been copied for %{time}s!"
url: "The URL has been copied in clipboard."
help: help:
name: "Help" name: "Help"
url: "Press <u> to copy URL"
login: "Press <l> to copy the login" login: "Press <l> to copy the login"
password: "Press <p> to copy the password" password: "Press <p> to copy the password"
otp_code: "Press <o> to copy the otp code" otp_code: "Press <o> to copy the otp code"

View file

@ -111,8 +111,10 @@ fr:
login: "L'identifiant a été copié dans le presse papier" login: "L'identifiant a été copié dans le presse papier"
password: "Le mot de passe a été copié dans le presse papier pour 30s!" password: "Le mot de passe a été copié dans le presse papier pour 30s!"
otp: "Le code OTP a été copié dans le presse papier il est valable %{time}s!" otp: "Le code OTP a été copié dans le presse papier il est valable %{time}s!"
url: "L'URL a été copié dans le presse papier"
help: help:
name: "Aide" name: "Aide"
url: "Pressez <u> pour copier l'URL"
login: "Pressez <l> pour copier l'identifiant" login: "Pressez <l> pour copier l'identifiant"
password: "Pressez <p> pour copier le mot de passe" password: "Pressez <p> pour copier le mot de passe"
otp_code: "Pressez <o> pour copier le code OTP" otp_code: "Pressez <o> pour copier le code OTP"

View file

@ -300,6 +300,14 @@ module MPW
when 'q', 'quit' when 'q', 'quit'
break break
when 'u', 'url'
if clipboard
Clipboard.copy(item.url)
puts I18n.t('form.clipboard.url').green
else
puts item.url
end
when 'l', 'login' when 'l', 'login'
if clipboard if clipboard
Clipboard.copy(item.user) Clipboard.copy(item.user)
@ -332,6 +340,7 @@ module MPW
else else
puts "----- #{I18n.t('form.clipboard.help.name')} -----".cyan puts "----- #{I18n.t('form.clipboard.help.name')} -----".cyan
puts I18n.t('form.clipboard.help.url')
puts I18n.t('form.clipboard.help.login') puts I18n.t('form.clipboard.help.login')
puts I18n.t('form.clipboard.help.password') puts I18n.t('form.clipboard.help.password')
puts I18n.t('form.clipboard.help.otp_code') puts I18n.t('form.clipboard.help.otp_code')