Monarchz3ro / Silver

A unix inspired terminal mockup that is definitely not an emulator.
GNU General Public License v3.0
2 stars 2 forks source link

OUTPUT CHANGES: make `<user>@<machine> <level>` thing bold + change pwd output + add `mv` command #9

Closed OcelotWalrus closed 7 months ago

OcelotWalrus commented 7 months ago

This PR changes how the pwd output and how make the <user>@<machine> <level> thing bold:

Screenshot from 2024-02-18 16-51-42

I think it's better like that.

This PR now adds the mv command and a os.system('clear') at the beginning of the program.

Monarchz3ro commented 7 months ago

This terminal mockup is eventually going to be used in the Ren'Py console library made by Elckarow https://github.com/Elckarow/Console I'm not sure if ANSI escapes work with it, I'll ask around and see if that is the case

OcelotWalrus commented 7 months ago

This terminal mockup is eventually going to be used in the Ren'Py console library made by Elckarow https://github.com/Elckarow/Console I'm not sure if ANSI escapes work with it, I'll ask around and see if that is the case

Well logically no. But it's not obligatory, just a nice addition.

Monarchz3ro commented 7 months ago

Yeaaaah, I apologise for not making this clear in the readme and docs, I didn't expect any actual contributors to this lmao, I'm going to write up a contributing guide tomorrow

also okay, so about mv, here's the thing, right

the ideal case is that i want to make the player able to make their own python scripts and use the functions from the Terminal class like self.touch or self.write_file to be able to go about and make changes to their filesystem when you directly use methods like shutil.move, it bypasses the checks the terminal class has implemented within itself like

  1. checkxistence(path) to check if the file actually exists
  2. legal(path) to check if the file is WITHIN the terminal environment, within the root folder
  3. validated(path) to check if the file exists AND is legal

so that makes it so that if the user doesn't have permissions to write to the target directory, the mv function you're implementing directly shutil.move(path) to bypass those checks and directly move the file there

i'm very sorry for not making this clear, this is a small repo, i am new to github in general, and i was not expecting any contributors when i made this repo

OcelotWalrus commented 7 months ago

I understand, what I've made is not really in the concept of a shell, it's just a terminal prompt. My bad.

Monarchz3ro commented 7 months ago

This terminal mockup is eventually going to be used in the Ren'Py console library made by Elckarow https://github.com/Elckarow/Console I'm not sure if ANSI escapes work with it, I'll ask around and see if that is the case

As follow up to this, I've discovered the ANSI escapes are indeed not supported by the console lib I was talking about.

OcelotWalrus commented 7 months ago

I'll make a new PR with the mv command and my changes to the pwd command, while respecting what you said sooner:

Yeaaaah, I apologise for not making this clear in the readme and docs, I didn't expect any actual contributors to this lmao, I'm going to write up a contributing guide tomorrow

also okay, so about mv, here's the thing, right

the ideal case is that i want to make the player able to make their own python scripts and use the functions from the Terminal class like self.touch or self.write_file to be able to go about and make changes to their filesystem when you directly use methods like shutil.move, it bypasses the checks the terminal class has implemented within itself like

1. `checkxistence(path)` to check if the file actually exists

2. `legal(path)` to check if the file is WITHIN the terminal environment, within the root folder

3. `validated(path)` to check if the file exists AND is legal

so that makes it so that if the user doesn't have permissions to write to the target directory, the mv function you're implementing directly shutil.move(path) to bypass those checks and directly move the file there

i'm very sorry for not making this clear, this is a small repo, i am new to github in general, and i was not expecting any contributors when i made this repo

P.-S.: I'm also going to work on the su command.