read pwd.yml from program folder
This commit is contained in:
parent
b3d0e8c058
commit
038e8a0b14
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,5 +3,3 @@
|
|||||||
/bin/
|
/bin/
|
||||||
/.shards/
|
/.shards/
|
||||||
*.dwarf
|
*.dwarf
|
||||||
|
|
||||||
pwd.yml
|
|
||||||
|
10
HISTORY.md
Normal file
10
HISTORY.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
## Legend
|
||||||
|
- 🐛 - Bug
|
||||||
|
- ✔️ - Fixed
|
||||||
|
- ❌ - Removed
|
||||||
|
- ➕ - Added
|
||||||
|
- ℹ️ - Information
|
||||||
|
- ♻️ - Edited
|
||||||
|
|
||||||
|
## 0.2.0 - [04/01/2022]
|
||||||
|
- reading passwords file from program folder (portable mode)
|
17
src/pmng.cr
17
src/pmng.cr
@ -25,7 +25,7 @@ VERSION = "0.1.0"
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
OptionParser.parse do |parser|
|
OptionParser.parse do |parser|
|
||||||
parser.banner = "Welcome to The Beatles App!"
|
parser.banner = "pmng -- ver.: #{VERSION}\nThe 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}"
|
||||||
@ -50,16 +50,21 @@ rescue ex
|
|||||||
puts ex.message, ""
|
puts ex.message, ""
|
||||||
end
|
end
|
||||||
|
|
||||||
if !File.exists?("pwd.yml")
|
password_file_path = PROGRAM_NAME.split("/")
|
||||||
|
password_file_path.pop
|
||||||
|
password_file_path.insert(-1, "pwd.yml")
|
||||||
|
password_file_path = password_file_path.join("/")
|
||||||
|
|
||||||
|
if File.exists?(password_file_path)
|
||||||
|
yaml = File.open(password_file_path) do |file|
|
||||||
|
YAML.parse(file)
|
||||||
|
end
|
||||||
|
else
|
||||||
puts "No password.yml file exists."
|
puts "No password.yml file exists."
|
||||||
|
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
yaml = File.open("pwd.yml") do |file|
|
|
||||||
YAML.parse(file)
|
|
||||||
end
|
|
||||||
|
|
||||||
new_array = [] of Password
|
new_array = [] of Password
|
||||||
count = 0
|
count = 0
|
||||||
while count < yaml.size
|
while count < yaml.size
|
||||||
|
Loading…
Reference in New Issue
Block a user