rshell directory syntax

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
smhodge
Posts: 21
Joined: Tue Jan 22, 2019 2:16 am

rshell directory syntax

Post by smhodge » Sun Dec 01, 2019 12:16 am

Does rshell support the usual directory syntax, such as "cd .." to go to the parent directory, or "." for current directory? I'm having trouble using rshell and this may be the root of my problems. Thanks

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell directory syntax

Post by dhylands » Sun Dec 01, 2019 3:54 am

Yep. It tries to treat the micropython filesystem as an extension of the host file system, and tries to provide a command line like experience similar to Linux. I don’t know how cd . behaves but cd .. should behave as expected.

What type of problems are you running into? Can you include a copy of a session with problems?

smhodge
Posts: 21
Joined: Tue Jan 22, 2019 2:16 am

Re: rshell directory syntax

Post by smhodge » Tue Dec 03, 2019 6:54 pm

The issue is cd won't back up higher than the directory rshell was opened in. It goes down and then back up ok.

I use Windows to open powershell in my top-level uPython project folder, "D:\steve\Projects\uPython", and then run a batch file in that folder to open rshell. The batch file is simply:

@echo off
python "C:\Program Files\Python37\Lib\site-packages\rshell\main.py" -n

The rshell prompt is then (as expected):

D:\steve\Projects\uPython>

But, for example:

D:\steve\Projects\uPython> ls
COS/ Flash1.sln Flash2/ ReplCode.txt Test/ rshell.bat
Docs/ Flash1/ Flash3/ ReplSession 1.txt Test1/ rsync.bat
D:\steve\Projects\uPython> cd test
D:\steve\Projects\uPython/test>
D:\steve\Projects\uPython/test> ls
boot.py testLed.pycd ..
D:\steve\Projects\uPython/test> cd ..
D:\steve\Projects\uPython>
D:\steve\Projects\uPython> cd ..
D:\steve\Projects\uPython>

steve

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell directory syntax

Post by dhylands » Tue Dec 03, 2019 11:22 pm

It seems to be a windows peculiarity.

rshell is looking for a forward slash cd and when you do cd .. it will remove any trailing directory delimited by a forward slash.

Under windows, the current directory is presented with a back-slash and that's what's causing the problem.

I'll file an issue with rshell.

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell directory syntax

Post by dhylands » Wed Dec 04, 2019 12:00 am

As a temporary workaround, from the rshell prompt you can do a cd /steve/Projects/uPython then cd .. should work.

rshell still doesn't recognize drive letters, so there isn't any way to access files on the C: drive from the D: drive.

smhodge
Posts: 21
Joined: Tue Jan 22, 2019 2:16 am

Re: rshell directory syntax

Post by smhodge » Wed Dec 04, 2019 11:33 pm

Thanks. Yes, it works to go back up the tree once you've gone down the tree from the start point. It just can't go further up than the start point.

Post Reply