Compare commits

...

3 Commits

Author SHA1 Message Date
038e8a0b14 read pwd.yml from program folder 2022-01-04 22:31:02 +03:00
b3d0e8c058 fix exit() 2022-01-04 00:52:31 +03:00
fbe8c494ec using ameba 2022-01-04 00:30:41 +03:00
7 changed files with 41 additions and 32 deletions

5
.gitignore vendored
View File

@ -3,8 +3,3 @@
/bin/
/.shards/
*.dwarf
/src/views/
data.json
pwd.yml

10
HISTORY.md Normal file
View 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)

View File

@ -1 +1 @@
# passw0rd_manager
# pmng

View File

@ -1,2 +1,6 @@
version: 2.0
shards: {}
shards:
ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 0.14.3

View File

@ -1,14 +1,17 @@
name: passw0rd_manager
name: pmng
version: 0.1.0
authors:
- Alexander Popov <iiiypuk@iiiypuk.me>
targets:
passw0rd_manager:
main: src/passw0rd_manager.cr
pmng:
main: src/pmng.cr
dependencies:
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 0.14.0
crystal: 1.2.2

View File

@ -1,9 +0,0 @@
require "./spec_helper"
describe Passw0rdManager do
# TODO: Write tests
it "works" do
false.should eq(true)
end
end

View File

@ -25,41 +25,46 @@ VERSION = "0.1.0"
begin
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
puts "Version #{VERSION}"
exit
exit(0)
end
parser.on "-h", "--help", "Show help" do
puts parser
exit
exit(0)
end
parser.on "-g", "--generate-password", "Generate password" do
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:black).back(:white)
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:white).back(:red)
puts Random::Secure.urlsafe_base64(16, padding: false).colorize(:white).back(:blue)
exit
exit(0)
end
parser.on "-t", "--unixtime", "Return local timestamp" do
puts Time.local.to_unix.colorize(:yellow)
exit
exit(0)
end
end
rescue ex
puts ex.message, ""
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."
exit(1)
end
yaml = File.open("pwd.yml") do |file|
YAML.parse(file)
end
new_array = [] of Password
count = 0
while count < yaml.size
@ -67,13 +72,14 @@ while count < yaml.size
count += 1
end
while true
loop = true
while loop
print "Enter URL (or :q for exit)\n> "
password_string = gets
if password_string.to_s == ":q"
puts "Bye! 👋🏻"
exit
exit(0)
elsif password_string.to_s == ":h"
puts "Help:\n-----"
puts ":s - Return stats"