Skip to content

Commit 5ea4749

Browse files
Initial commit.
1 parent 17c81a1 commit 5ea4749

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

build.lisp

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(pushnew (uiop::getcwd) ql:*local-project-directories*)
2+
(ql:quickload :passwd-manager)
3+
(ql:quickload :cl-fad)
4+
(asdf:make :passwd-manager)

lisp-passwd

44.1 MB
Binary file not shown.

passwd-manager.asd

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(defsystem "passwd-manager"
2+
3+
:depends-on (
4+
#:cl-fad
5+
)
6+
7+
:components ((:module "src"
8+
:components
9+
((:file "passwd-manager"))))
10+
11+
:build-operation "program-op"
12+
:build-pathname "lisp-passwd"
13+
:entry-point "passwd-manager::main"
14+
15+
)

src/passwd-manager.lisp

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
(defpackage #:passwd-manager
2+
(:use :cl))
3+
4+
(in-package #:passwd-manager)
5+
6+
(ql:quickload :cl-fad)
7+
8+
(defun create-passwd ()
9+
10+
(format t "Programme name: ~&")
11+
(defvar programme-name)
12+
(defvar programme-password)
13+
(setf programme-name (read))
14+
15+
16+
(cond
17+
18+
((cl-fad:file-exists-p (format nil "./~a/" programme-name)) (format t "It already exists. ~&"))
19+
20+
21+
(t (with-open-file (stream (format nil "./~a" programme-name) :if-exists :append :direction :output :if-does-not-exist :create)
22+
(format t "Enter the passwd:~&")
23+
(setf programme-password (read))
24+
(format stream "~a ~&" (string-downcase programme-password))
25+
))
26+
27+
)
28+
)
29+
30+
(defun see-passwd ()
31+
32+
(format t "Programme name: ~&")
33+
(defvar programme-name)
34+
(setf programme-name (read))
35+
36+
(cond
37+
((cl-fad:file-exists-p (format nil "./~a/" programme-name))
38+
(with-open-file (stream (format nil "./~a/" programme-name) :if-does-not-exist nil)
39+
(loop for line = (read-line stream nil)
40+
while line do (format t "Passwd: ~a" line)
41+
)
42+
)
43+
)
44+
)
45+
46+
)
47+
48+
(defun del-passwd ()
49+
50+
(format t "Programme name: ~&")
51+
(defvar programme-name)
52+
(setf programme-name (read))
53+
54+
(cond
55+
((cl-fad:file-exists-p (format nil "./~a/" programme-name))
56+
(uiop:delete-file-if-exists (format nil "./~a/" programme-name))
57+
)
58+
)
59+
60+
)
61+
62+
(defun menu ()
63+
64+
(format t "1. Create entry~&2. See the password~&3. Delete the password~&")
65+
66+
(format t "Choose an option:~&")
67+
68+
(defvar option (make-array '(0) :element-type 'base-char :adjustable t))
69+
(setf option (read-line))
70+
71+
(cond
72+
73+
((= 1 (parse-integer option)) (create-passwd))
74+
((= 2 (parse-integer option)) (see-passwd))
75+
((= 3 (parse-integer option)) (del-passwd))
76+
77+
(t (format t "There's no such option. ~&"))
78+
)
79+
80+
81+
)
82+
83+
(defun main ()
84+
(menu)
85+
)

system-index.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
passwd-manager.asd

0 commit comments

Comments
 (0)