From e7e4f43c5d8a64c47a618520cfe49959d3700e4a Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 21 Nov 2017 18:45:06 -0500 Subject: [PATCH] Add base structure to pass.cr --- src/pass.cr | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/pass.cr b/src/pass.cr index 95638f2..7afb1d9 100644 --- a/src/pass.cr +++ b/src/pass.cr @@ -27,3 +27,100 @@ # Placeholder for the library we create to handle the plain text file format require "txt" +require "trucolor" + +module Pass + extend self + + def pass() + Pass.status() if ARGV.size() == 0 + case ARGV[0].delete("-") + when "get"; Pass.get() + when "status"; Pass.status() + when "help"; Pass.help() + when "add"; Pass.add() + when "remove"; Pass.remove() + when "list"; Pass.list() + when "update"; Pass.update() + when "gen"; Pass.gen() + when "new"; Pass._new() + else Pass.unknown() + end + end + + def help() + puts "Help" + exit 0 + end + + def unknown() + puts "Unknown" + exit 1 + end + + # Show statistics about password usage such as the number of passwords, + # the length of the shortest password and the length of the longest password + # Show information about any passwords that haven't been changed in a while + # TODO: Allow the user to define how long before this notice appears? + def status() + puts "Status" + exit 0 + end + + # Get the password for a specific service + # TODO: Allow the user to get other things as well (e.g. username) by explicitly specifying it? + def get() + puts "Get" + exit 0 + end + + # Add a new username / password combination to pass, allowing the user to specify + # other information as well, such as domain(s) + def add() + puts "Add" + exit 0 + end + + # Remove a specific service from the password manager + # NOTE: This may not work for multiple accounts on the same domain, depending on whether + # or not this is a feature worth implementing + def remove() + puts "Remove" + exit 0 + end + + # Shows all the services in the database but not their passwords + # TODO: Enable a user to create their own lists by using [Brackets] (?) + # If so, make these lists accessible through pass list + def list() + puts "List" + exit 0 + end + + # Update an existing password with a new password + # TODO: Decide whether you prefer `pass update` or `pass up` for this task + def update() + puts "Update" + exit 0 + end + + # Generate a new password + # TODO: Decide whether or not `pass gen` should simply generate a password + # or save it as well (maybe another method would be better for this) + def gen() + puts "Gen" + exit 0 + end + + # Add a new service with an automatically generated password + # TODO: The user must (?) specify the username and domain(s) + # TODO (?): Find a better name than _new() since new is a reserved word + # TODO (?): Make Passwords their own class (ideally they should extend from "TextItems") + def _new() + puts "New" + exit 0 + end +end + +Pass.pass() +