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

Shell Upgrade And Fixes #16

Closed OcelotWalrus closed 4 months ago

OcelotWalrus commented 4 months ago

This PR adds many stuff and here it is:

I recommend you to look every code I've made

.pathosrc files

These are files located in every user home folders, and are like the .bashrc file in linux for here for the 'pathos shell'. It's here that there's the user environment configuration.

Here's how it looks for now:

# .pathosrc

# User specific environment

PATH='bin'
EXPORT hello='hello!'

# User specific aliases and functions

alias ll='ls -l'
alias la='ls -l -a'

NOTE: There's definitely a lot of stuff that can be optimized/upgraded in this part code

Date fix

I've fixed the self.current_time variable with these changes:

current_date: str = date.today() # output `2024, 2, 20`
current_formatted_data:str = current_date.strftime("%d %b %Y") # output `20 Feb 2024`

Unused imports

I've removed two import os from both mv.py and clear.py class and I've created a clear_prompt function so the clear command doesn't get skipped now.

Grammar Fixes

In parallel, I've fixed some grammar typoes/errors I've encountered.

Monarchz3ro commented 4 months ago

Absolutely thank you for this! I was intending to do something similar, this is certainly a step in the right direction! p.s those aren't typos, I'm used to British spellings by default <.<

Monarchz3ro commented 4 months ago

Also, the os.system('clear') command only works for unix systems, if I am right. For Windows. it is cls. We should omit that command as the console library I intend to use has a built in way to clear the screen.

Monarchz3ro commented 4 months ago

p.p.p.s Incredibly sorry for not making this already obvious, but PathOS is intended to be the name of the player's operating system, and Silver is supposed to be the name of the shell used. It is fine if you wish to use the name pathosrc though.

OcelotWalrus commented 4 months ago

Absolutely thank you for this! I was intending to do something similar, this is certainly a step in the right direction!

Thanks!

p.s those aren't typos, I'm used to British spellings by default <.<

You're british?

Also, the os.system('clear') command only works for unix systems, if I am right. For Windows. it is cls. We should omit that command as the console library I intend to use has a built in way to clear the screen.

Something like that could work:

from os import system, name

def clear():

    # for windows
    if name == 'nt':
        _ = system('cls')

    # for mac and linux(here, os.name is 'posix')
    else:
        _ = system('clear')

p.p.p.s Incredibly sorry for not making this already obvious, but PathOS is intended to be the name of the player's operating system, and Silver is supposed to be the name of the shell used. It is fine if you wish to use the name pathosrc though.

Sorry I've misunderstood. So PathOS' also the machine name? The thing after the @ is supposed to be the machine name in normal systems.

OcelotWalrus commented 4 months ago

I've also recently fixed the pathos_bus_mkdir and pathos_bus_mkdir_p functions, that were using a os.makedirs(os.path.join(self.root_dir, path)) instead of os.makedirs(os.path.join(self.current_directory, path)), making that created directories were always created in the root directory and not in the current directory.

[+] I've created another default alias rmdir for rm -r. [+] added uname command [+] add locate command

OcelotWalrus commented 4 months ago

I have a question: should I replace every every print() method my the self.cout method?

Monarchz3ro commented 4 months ago

You're British?

No, I am from a commonwealth country, where the English spoken is British.

Sorry I've misunderstood. So PathOS' also the machine name? The thing after the @ is supposed to be the machine name in normal systems.

I was not aware of that, but we will default that to PathOS. I feel it is inline with the spirit of the game. Also, many Linux distros have the machine name as the operating system then, if I am right. Such as x@fedora, x@kali or x@parrot.

Regarding the fixes, thank you. The ecosystem was limited to the root and a few folders so I did not care to make directories inside /boot or /bin, and thus never came across that bug.

[+] I've created another default alias rmdir for rm -r. [+] added uname command

I need to take a closer look at your implementation to make sure I don't accidentally mess with it during future commits.

I have a question: should I replace every every print() method my the self.cout method?

Yes. self.cout is intended to pipe the output to the console library when I think I am 'done' with the project and want to finally use the library with it. Print defaults to echoing the output into a terminal, and since Ren'Py's screens will never be true terminals, I do not think print will work with it.

OcelotWalrus commented 4 months ago

I was not aware of that, but we will default that to PathOS. I feel it is inline with the spirit of the game. Also, many Linux distros have the machine name as the operating system then, if I am right. Such as x@fedora, x@kali or x@parrot.

Yes that's the default.

I need to take a closer look at your implementation to make sure I don't accidentally mess with it during future commits.

Of course!

Yes. self.cout is intended to pipe the output to the console library when I think I am 'done' with the project and want to finally use the library with it. Print defaults to echoing the output into a terminal, and since Ren'Py's screens will never be true terminals, I do not think print will work with it.

Okay, I'm doing that right now.

OcelotWalrus commented 4 months ago

I've replace every print() function by a cout(function) and I've added a check when using the locate function to filter the ecosystem and only get the files with "r" permission for the user.

Monarchz3ro commented 4 months ago

Thank you. At this point you're effectively more productive than I, haha.

Monarchz3ro commented 4 months ago

Also, you do not need to 'unbritish' my spellings from this point forward.

OcelotWalrus commented 4 months ago

Also, you do not need to 'unbritish' my spellings from this point forward.

Okay sorry, it's just that vscode think that your s' instead of z' are spelling errors, and for me 'z' is the correct spelling.

Thank you. At this point you're effectively more productive than I, haha.

It's just that this project's different from own project, which is at this point kinda annoying because there's stuff that I have to code but it's almost the same things over and over. And also perhaps because I'm sick and stuck at home for the whole day ;D

OcelotWalrus commented 4 months ago

And it's also kinda annoying that I don't get any contributors on it.

Monarchz3ro commented 4 months ago

If it is annoying, do not engage. No one is holding you at gunpoint to contribute to the repo. You've already been a massive help as is.

OcelotWalrus commented 4 months ago

If it is annoying, do not engage. No one is holding you at gunpoint to contribute to the repo. You've already been a massive help as is.

It's my project who's at the current point annoying.

Monarchz3ro commented 4 months ago

Ah, I misunderstood. My bad.

OcelotWalrus commented 4 months ago

No worries.

OcelotWalrus commented 4 months ago

Here's what I have to do:

image

each 'code x effect' take about 1/2 hour and its quite the same thing over and over; but the final result'll be very satisfying.

Monarchz3ro commented 4 months ago

Ah, grunt work. Hate that. Usually I'd let Copilot handle that stuff for me so I can speed through.

OcelotWalrus commented 4 months ago

Ah, grunt work. Hate that. Usually I'd let Copilot handle that stuff for me so I can speed through.

Yes, but it's not the same system for every effect: each effect, even if in global it's the same code over and over, it's a different system

OcelotWalrus commented 4 months ago

It's my own game Bane Of Wargs, which is an ASCII art terminal RPG game-engine (a game where you can load plugins that're extremely customizable and that totally replace the vanilla data/plot).

Monarchz3ro commented 4 months ago

I know of it, I felt it was interesting and wanted to give it a spin. Have not done so yet though, but certainly will.

OcelotWalrus commented 4 months ago

I know of it, I felt it was interesting and wanted to give it a spin. Have not done so yet though, but certainly will.

Thanks appreciate! If you have any questions about it in the future, ask them in the discussions!