-
Notifications
You must be signed in to change notification settings - Fork 1.1k
upysh: Added rm, rmdir, clear and simplified help #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- commands added: rm, rmdir and clear - comands simplified: help does not need brackets any more - help text rearranged - pwd replaces empty string by "/"
Hello Paul. I really love that little script of yours and immediately added it to the Micropython board images. Even if urgently needed on PyBoard and Wipy, I find myself often issuing sh command at the REPL prompt. I polished and extended it a little bit, hopefully in your intent.
Best Regards, Robert
Show file info similar to ls -l
@robert-hh : Thanks. This contains some good ideas, but I'm not sure they all suitable for upysh as-is and right away. I've added rm, rmdir commands for now. I like an idea to use "man" for help, but people should know it's man, so I've made help to print on module load for now.
But: upysh is intended to be a filesystem shell, so things like "clear" are outside of its scope. It's also intended to be a very minimal shell, so printing date/time are also outside of its scope, at least for now (I find a file size to be a valuable info, and myself almost always pay attention to file size; contrary, I rather rarely consult file's time).
Hello Paul,
Thanks for the comment. I was unsure about man- Help() collided with the
buitl-in command. But printing it a module start is surely a good
compromise. The 'clear' was requested by someone else. I rarely use it.
But the file date is more a matter of personal preference. I a m using
it as often as the file size, especially when working with data files,
which often have the same size. Then the date gets important. And
together with the PR2160 of Micropython, it can have a meaningful value.
Best Regards, Robert
On 12.06.2016 20:59, Paul Sokolovsky wrote:
@robert-hh https://github.com/robert-hh : Thanks. This contains some
good ideas, but I'm not sure they all suitable for upysh as-is and right
away. I've added rm, rmdir commands for now. I like an idea to use "man"
for help, but people should know it's man, so I've made help to print on
module load for now.But: upysh is intended to be a filesystem shell, so things like "clear"
are outside of its scope. It's also intended to be a very minimal shell,
so printing date/time are also outside of its scope, at least for now (I
find a file size to be a valuable info, and myself almost always pay
attention to file size; contrary, I rather rarely consult file's time).—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#76 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AL5hxGwoZSk0vo9eKW3yATcaCFSaQyGiks5qLFctgaJpZM4IuKjj.
I use "clear" a lot and would be +1 on including it. It is related to "file" interaction, eg clearing the screen before cat'ing or ls'ing so you can see things clearly.
@dpgeorge : Well, if you use it, what can we do? ;-). But mind my concern: I started upysh because I considered @dhylands' upy-shell too big. I don't want it to grow to be just a fork of upy-shell. Of course, any single function, we can add, but it's main purpose is to run on some 2K-heap (where it of course already won't run).
Anyway, are you sure it should be "clear" and not "cls" for example?
'clear' is the unix/linux command, 'cls' is windows/dos. Since upysh mimics unix, it would be 'clear'. The aspect of RAM usage could be get less important for esp8266, if Damien's PR2067 would get mainstream.
"cls" is what random human walking down the street would remember about clearing screen, because s/he read a BASIC book somehere in childhood (or for whatever) reason. It's also shorter.
The aspect of RAM usage could be get less important for esp8266, if Damien's PR2067 would get mainstream.
upysh has nothing to do with esp8266, it's just a most minimal to still be useful file shell. Nor any hacks would help it - it itself a hack, made to influence as little as possible anything ride side by side with it. And memory will always be a scarce resource.
Anyway, are you sure it should be "clear" and not "cls" for example?
@dpgeorge : ping
I've implemented "man" command now, thanks for the idea, @robert-hh !
I'd say it should be "clear", since, as @robert-hh says, all other commands are unixy. But if its addition is controversial then don't worry about it.
BTW, if minimal is the goal then making extra clases for, eg, ls, just so you don't need to type parenthesis, seems a bit excessive. But then, balancing minimal with usability is always hard (and I'd say the addition of "clear" is a usability thing).
When placing upysh into frozen bytecode, the variant with classes uses about 1300 bytes of heap space, whereas a version without classes uses 640 bytes. That's my private copy, which is a little bit larger than Paul's, including clear and date & time on ls. From my previous fights for space I recall, that every class defintion take about 200 bytes of heap. That matches the difference roughly.
- Thank you all for upysh!
- Today on a freshly flashed ESP8266:
>>> from upysh import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "upysh.py", line 35, in <module>
AttributeError: 'module' object has no attribute 'rmdir'
... because there's no uos.rmdir() on ESP8266.
Although upysh.py bug fix
- rmdir = os.rmdir
+ rmdir = os.remove
works (on ESP8266), I'm not sure if it would be the correct solution for all platforms? (I therefore canceled #81).
os.rmdir() was implemented in esp8266 port. "clear" command was added, based on implementation in this patch. Thanks!
Uh oh!
There was an error while loading. Please reload this page.