mirror of
https://github.com/danielmiessler/fabric
synced 2024-11-10 07:10:31 +00:00
added session log to view your sessions
This commit is contained in:
parent
017945f484
commit
b5ee3d38a3
@ -31,6 +31,7 @@ def main():
|
||||
parser.add_argument('--session', '-S',
|
||||
help="Continue your previous conversation. Default is your previous conversation", nargs="?", const="default")
|
||||
parser.add_argument('--clearsession', help="deletes indicated session. Use 'all' to delete all dessions")
|
||||
parser.add_argument('--sessionlog', help="View the log of a session")
|
||||
parser.add_argument(
|
||||
"--gui", help="Use the GUI (Node and npm need to be installed)", action="store_true")
|
||||
parser.add_argument(
|
||||
@ -133,6 +134,11 @@ def main():
|
||||
else:
|
||||
print(f"Session {args.clearsession} cleared")
|
||||
sys.exit()
|
||||
if args.sessionlog:
|
||||
from .helper import Session
|
||||
session = Session()
|
||||
print(session.session_log(args.sessionlog))
|
||||
sys.exit()
|
||||
standalone = Standalone(args, args.pattern)
|
||||
if args.list:
|
||||
try:
|
||||
|
@ -49,3 +49,9 @@ class Session:
|
||||
os.remove(os.path.join(self.sessions_folder, file))
|
||||
else:
|
||||
os.remove(os.path.join(self.sessions_folder, session))
|
||||
def session_log(self, session):
|
||||
file = os.path.join(self.sessions_folder, session)
|
||||
if not os.path.exists(file):
|
||||
return None
|
||||
with open(file, "r") as f:
|
||||
return f.read()
|
||||
|
Loading…
Reference in New Issue
Block a user