0.2.1
This commit is contained in:
parent
6fc0459d81
commit
d49dcda651
@ -6,7 +6,9 @@
|
|||||||
- ℹ️ - Information
|
- ℹ️ - Information
|
||||||
- ♻️ - Edited
|
- ♻️ - Edited
|
||||||
|
|
||||||
## 0.2.1 - [13/03/2022]
|
## 0.2.1 - [14/03/2022]
|
||||||
|
- ➕ - prompt '>' set color green
|
||||||
|
- ♻️ - change default pwd path to '$HOME/.pwd.yml'
|
||||||
- ✔️ - fixed empty search field
|
- ✔️ - fixed empty search field
|
||||||
- ✔️ - fixed password generate colors to russian flag
|
- ✔️ - fixed password generate colors to russian flag
|
||||||
|
|
||||||
|
16
src/pmng.cr
16
src/pmng.cr
@ -27,7 +27,7 @@ VERSION = "0.2.1"
|
|||||||
# program options
|
# program options
|
||||||
begin
|
begin
|
||||||
OptionParser.parse do |parser|
|
OptionParser.parse do |parser|
|
||||||
parser.banner = "pmng -- ver.: #{VERSION}\nThe very simple password manager for humans\n"
|
parser.banner = "The very simple password manager for humans\n"
|
||||||
|
|
||||||
parser.on "-v", "--version", "Show version" do
|
parser.on "-v", "--version", "Show version" do
|
||||||
puts "Version #{VERSION}"
|
puts "Version #{VERSION}"
|
||||||
@ -71,10 +71,11 @@ else
|
|||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
new_array = [] of Password
|
# fill passwords array
|
||||||
|
passwords_array = [] of Password
|
||||||
count = 0
|
count = 0
|
||||||
while count < yaml.size
|
while count < yaml.size
|
||||||
new_array << Password.from_yaml(yaml[count].to_yaml)
|
passwords_array << Password.from_yaml(yaml[count].to_yaml)
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -82,7 +83,8 @@ end
|
|||||||
loop = true
|
loop = true
|
||||||
while loop
|
while loop
|
||||||
# shell prompt
|
# shell prompt
|
||||||
print "Enter URL (or :q for exit)\n> "
|
print "Enter URL (or :q for exit)\n"
|
||||||
|
print "> ".colorize(:green)
|
||||||
password_string = gets
|
password_string = gets
|
||||||
|
|
||||||
# if ':q' to close program
|
# if ':q' to close program
|
||||||
@ -100,13 +102,13 @@ while loop
|
|||||||
elsif password_string.to_s == ":s"
|
elsif password_string.to_s == ":s"
|
||||||
puts "Statistics:\n----------"
|
puts "Statistics:\n----------"
|
||||||
print "Elements: ".colorize(:yellow)
|
print "Elements: ".colorize(:yellow)
|
||||||
puts new_array.size
|
puts passwords_array.size
|
||||||
|
|
||||||
print "Outdated: ".colorize(:red)
|
print "Outdated: ".colorize(:red)
|
||||||
outdated_count = 0
|
outdated_count = 0
|
||||||
current_time = Time.local.to_unix
|
current_time = Time.local.to_unix
|
||||||
a = [] of String
|
a = [] of String
|
||||||
new_array.each do |item|
|
passwords_array.each do |item|
|
||||||
if item.update + (2629743 * 2) < current_time # 2629743 * 2 -- 2 month
|
if item.update + (2629743 * 2) < current_time # 2629743 * 2 -- 2 month
|
||||||
outdated_count += 1
|
outdated_count += 1
|
||||||
a << item.url
|
a << item.url
|
||||||
@ -116,7 +118,7 @@ while loop
|
|||||||
puts outdated_count
|
puts outdated_count
|
||||||
# list search password
|
# list search password
|
||||||
else
|
else
|
||||||
new_array.each do |item|
|
passwords_array.each do |item|
|
||||||
if item.url.includes?(password_string.to_s)
|
if item.url.includes?(password_string.to_s)
|
||||||
puts item.url.colorize(:magenta).mode(:blink)
|
puts item.url.colorize(:magenta).mode(:blink)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user