Skip to content

Commit

Permalink
added shell time indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Sep 17, 2023
1 parent a3e4551 commit c52ace5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cat_win/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from datetime import datetime
from functools import lru_cache
from itertools import groupby
from time import monotonic
import os
import platform
import re
Expand Down Expand Up @@ -1143,6 +1144,7 @@ def shell_main():
shell_prefix = '>>> '
eof_control_char = 'Z' if on_windows_os else 'D'
oneline = holder.args_id[ARGS_ONELINE]
shell_session_time_start = monotonic()

class CmdExec:
"""
Expand Down Expand Up @@ -1188,9 +1190,13 @@ def _command_unknown(self, _) -> None:
self.last_cmd, "'.", sep='')

def _command_cat(self, _) -> None:
shell_session_time = monotonic()-shell_session_time_start
hrs, mins, secs = (int(shell_session_time/3600),
int(shell_session_time%3600/60),
int(shell_session_time%60))
cat = " ,_ _\n |\\\\_,-~/\n / _ _ | ,--.\n( @ @ ) / ,-'\n \\ _T_/"
cat += "-._( (\n / `. \\\n| _ \\ |\n \\ \\ , / |\n || "
cat += "|-_\\__ /\n ((_/`(____,-'\a\n"
cat += f"|-_\\__ /\n ((_/`(____,-' Session time: {hrs:02d}:{mins:02d}:{secs:02d}s\a\n"
print('\n'.join(['\t\t\t' + c for c in cat.split('\n')]))

def _command_help(self, _) -> None:
Expand Down

0 comments on commit c52ace5

Please sign in to comment.