rshell - Remote Shell

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Sun Feb 28, 2021 5:28 pm

It even does file transfers to the Pico on this laptop. This proved troublesome with the old version.
Peter Hinch
Index to my micropython libraries.

doublevee
Posts: 75
Joined: Mon Jul 02, 2018 11:09 pm

Re: rshell - Remote Shell

Post by doublevee » Sun Feb 28, 2021 6:41 pm

Thank you Dave - that’s great

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

Re: rshell - Remote Shell

Post by dhylands » Mon Mar 01, 2021 10:29 pm

I think I screwed up the 0.0.29 release - I messed up my merge.

So I created 0.0.30.

webtran
Posts: 9
Joined: Mon Jul 19, 2021 3:37 am

Re: I suggest macros

Post by webtran » Mon Jul 19, 2021 3:54 am

pythoncoder wrote:
Sat Feb 27, 2021 2:45 pm
As mentioned above, I have a fork of rshell providing text macros documented here. The macros can be arranged to load when rshell starts. I have an alias for each project which exports an environment variable: this ensures that rshell imports a set of macros for that project when it starts up. I can then issue (say)

Code: Select all

> m drivers /pyboard
which changes to the correct source directory and performs an rsync to (in this case) /pyboard/drivers. You could define a macro for each of your standard directories.

The macro facility has transformed my use of rshell: it saves a lot of errors and greatly simplifies the maintenance of multiple bigger projects.
Awesome! however somehow I am unable to install your version, I am getting version 0.0.30.

Code: Select all

rshell: error: unrecognized arguments: -m

webtran
Posts: 9
Joined: Mon Jul 19, 2021 3:37 am

Re: I suggest macros

Post by webtran » Mon Jul 19, 2021 3:57 am

pythoncoder wrote:
Sat Feb 27, 2021 2:45 pm
As mentioned above, I have a fork of rshell providing text macros documented here. The macros can be arranged to load when rshell starts. I have an alias for each project which exports an environment variable: this ensures that rshell imports a set of macros for that project when it starts up. I can then issue (say)

Code: Select all

> m drivers /pyboard
which changes to the correct source directory and performs an rsync to (in this case) /pyboard/drivers. You could define a macro for each of your standard directories.

The macro facility has transformed my use of rshell: it saves a lot of errors and greatly simplifies the maintenance of multiple bigger projects.
Awesome! however somehow I am unable to install your version, I am getting version 0.0.30.

Code: Select all

rshell: error: unrecognized arguments: -m

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Mon Jul 19, 2021 5:01 am

To install my version you need to clone my repo onto your PC. Create a directory, move to it, and issue:

Code: Select all

git clone https://github.com/peterhinch/rshell
[EDIT] These instructions are wrong. Please see later post.

Then copy the file rshell/main.py over the original main.py, also replace README.rst. You can locate the original with

Code: Select all

[adminpete@capybara]: ~
$ which rshell
/usr/local/bin/rshell
It will still report V0.0.30 but should respond to e.g. lm

Once you've tested it you can remove the directory tree with the clone.

I will update my version of the README to clarify this.
Last edited by pythoncoder on Tue Jul 20, 2021 1:58 pm, edited 1 time in total.
Reason: I made a mistake in my instructions
Peter Hinch
Index to my micropython libraries.

webtran
Posts: 9
Joined: Mon Jul 19, 2021 3:37 am

Re: rshell - Remote Shell

Post by webtran » Mon Jul 19, 2021 8:33 am

Thanks Peter for the prompt answer. /usr/local/bin/rshell is a single file on my installation, with in it:

Code: Select all

#!/usr/bin/python
import re
import sys
from rshell.command_line import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
How could it be replaced with what I have cloned? Thanks.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Tue Jul 20, 2021 5:53 am

I'm sorry - you are right - my installation is nonstandard as I have other modifications to rshell.

That file is just a stub. The actual installation will be in a directory of the form

Code: Select all

$ find /usr -type d -name "rshell" -ls
 15206589      4 drwxr-sr-x   3 root     staff        4096 Sep 27  2019 /usr/local/lib/python3.6/dist-packages/rshell
where 3.x is your Python 3 installation. You'll need to replace main.py and to make my README.md accessible via a weblink or otherwise.
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Tue Jul 20, 2021 6:45 am

Another mod which may or may not be of interest may be found in the no_pc_delete branch of my repo. Though I manage to use bash daily without disaster, in rshell I have twice deleted my project from the PC rather than from the target. In addition to the macro feature this branch refuses to delete files or directories on the PC.
Peter Hinch
Index to my micropython libraries.

webtran
Posts: 9
Joined: Mon Jul 19, 2021 3:37 am

Re: rshell - Remote Shell

Post by webtran » Tue Jul 20, 2021 9:55 am

Thank you Peter, this is a great addition.
I'ven't try the version in your no_pc_delete branch yet.

Post Reply