11import os , animation , termcolor
22import socket
33from rich import print
4- from rich .console import Console
4+ from rich .console import Console
55import time
66import datetime
77from colorama import Fore
2222date = day + "-" + month + "-" + year
2323time = datetime .datetime .now ().strftime ("%H:%M" )
2424animation .animate ()
25+
2526while True :
26- console .print (f"[bold][chartreuse1]{ user } @{ name } [/] [magenta2]UNIX[/] [gold1]~{ '/' + path } [/]\n $[/]" , end = '' )
27+ console .print (
28+ f"[bold][chartreuse1]{ user } @{ name } [/] [magenta2]UNIX[/] [gold1]~{ '/' + path } [/]\n $[/]" ,
29+ end = "" ,
30+ )
2731 command = input (" " )
2832 if command .startswith ("touch" ):
2933 file = command .split ()
5256 table .add_column ("Name" , style = "dark_slate_gray1" )
5357 table .add_row ("-a----" , f"{ str (date )} \t { str (time )} " , "" , file [1 ])
5458 console .print (table )
55-
59+
5660 if command == commands [2 ]:
5761 listDir = os .listdir ()
5862 for i in listDir :
5963 ifDir = os .path .isdir (i )
6064 if ifDir :
6165 index = listDir .index (i )
6266 listDir [index ] = termcolor .colored (f"{ listDir [index ]} /" , "green" )
63- else : console .print ("unix: mkdir: file doesn't exist" )
64- print (' ' .join (listDir ))
65-
67+ else :
68+ console .print ("unix: mkdir: file doesn't exist" )
69+ print (" " .join (listDir ))
70+
6671 if command .startswith ("cat" ):
6772 file = command .split ()
6873 with open (file [1 ], "r" ) as f :
7277 if command .startswith ("cp" ):
7378 file = command .split ()
7479 length = file .__len__ ()
75- if length == 1 : console .print ("[magenta2]unix: [gold1]cp: missing file operand" )
76- if length == 2 : console .print ("[magenta2]unix: [gold1]cp: missing file to copy content" )
80+ if length == 1 :
81+ console .print ("[magenta2]unix: [gold1]cp: missing file operand" )
82+ if length == 2 :
83+ console .print ("[magenta2]unix: [gold1]cp: missing file to copy content" )
7784 else :
7885 with open (file [1 ], "r" ) as f :
7986 content = f .read ()
80- with open (file [2 ], 'a' ) as q :
87+ with open (file [2 ], "a" ) as q :
8188 q .write (f"\n { content } " )
8289
8390 if command .startswith ("del" ):
8491 file = command .split ()
8592 length = file .__len__ ()
86- if length == 1 : console .print ("[magenta2]unix: [gold1]del: missing file operand" )
87- else : os .remove (file [1 ])
93+ if length == 1 :
94+ console .print ("[magenta2]unix: [gold1]del: missing file operand" )
95+ else :
96+ os .remove (file [1 ])
8897
89- if command .startswith ('mv' ):
98+ if command .startswith ("mv" ):
9099 file = command .split ()
91100 length = file .__len__ ()
92- if length == 1 : console .print ("[magenta2]unix: [gold1]mv: missing file operand" )
93- if length == 2 : console .print ("[magenta2]unix: [gold1]mv: missing file to move content" )
101+ if length == 1 :
102+ console .print ("[magenta2]unix: [gold1]mv: missing file operand" )
103+ if length == 2 :
104+ console .print ("[magenta2]unix: [gold1]mv: missing file to move content" )
94105 else :
95106 try :
96107 with open (file [1 ], "r" ) as f :
97108 content = f .read ()
98- with open (file [2 ], 'a' ) as q :
109+ with open (file [2 ], "a" ) as q :
99110 q .write (f"\n { content } " )
100111 os .remove (file [1 ])
101- except : ...
112+ except :
113+ ...
0 commit comments