omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Advanced shell - shellista

    Pythonista
    16
    41
    44317
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • transistor1
      transistor1 last edited by

      @Rothrock42 - Pasting is probably the quickest way to get started. I have a "shellista" subfolder & I am keeping everything in there.

      If you are using <a href='https://github.com/transistor1/shellista'>this version</a>, you can stay synced with this repo using git clone:

      This assumes you're storing shellista in a subfolder of your home folder called "shellista".

      1. Launch your existing shellista version
      2. cd ~
      3. mkdir update (you can call this folder anything you want)
      4. cd update
      5. git clone https://github.com/transistor1/shellista.git
      6. cd ..
      7. rm shellista
      8. mv update shellista
      9. Close Pythonista and reload
      10. Open shellista and run it. It will re-download all the dependencies.

      Time willing, I'd like to add a git pull command to pull the latest updates.

      1 Reply Last reply Reply Quote 0
      • briarfox
        briarfox last edited by

        @transistor1 I edited my above post just as you posted. Would you mind if I used your code for a git plugin?

        1 Reply Last reply Reply Quote 0
        • transistor1
          transistor1 last edited by

          @briarfox - please be my guest ... all of this code is under the MIT license so it's all fair game! The modular approach sounds like a great idea! I was trying to maintain the original single-file approach to make it easy to paste into Pythonista-- but I thought about making it more modular too, because it's getting big.

          My mods to shellista download the Git/pipista dependencies automatically using @mark_tully's wget... I thought that a modular approach might work well if it automatically downloaded its plugins too. Does your version do that? That would be awesome.

          1 Reply Last reply Reply Quote 0
          • transistor1
            transistor1 last edited by

            @briarfox - I like your version a lot! If I had seen this a couple of days earlier I would have written my add-ins for your version. If the core module had a way of downloading the plugins, that would be ideal for new users -- they could just paste the core file into Pythonista and then it would bootstrap the plugins.

            1 Reply Last reply Reply Quote 0
            • briarfox
              briarfox last edited by

              @transistor1 Thanks! I just broke up the cmd into separate files that automatically load into shellista, it uses a very simple template. Most of ShellistaExt is the original code just broken apart. To get by the issue of the initial load into pythonista, just create a single script that grabs the zip from the github and loads it. Take a look at the setup of shellistaExt and let me know what you think. If you'd like to move to a plugin approach I'd be more then happy to contribute. I was finding that I was adding a lot of personal projects into shellista to make it easier to access and being able to just drop in a plugin or even a whole projects like pipista was handy.

              Currently the plugins do not auto update but thats a great idea. I'm still working on sftp and ssh auth keys instead of just password. I'm really curious how you got the git working. I tried for a bit and gave up and just wrote the ssh client to access another computer that syncs to dropbox.

              1 Reply Last reply Reply Quote 0
              • transistor1
                transistor1 last edited by

                I think the modular approach is the way to go -- I would be grateful for contributions... after seeing what you've done, I think you should really have the 'official' github repo of Shellista. If that doesn't work out, I've added you as a collaborator to my repo, so have at it!

                My only desire would be to add that script that grabs the zip directly into the ShellExt.py file... I know it probably uglifies things a bit, but it would be important for a nice user experience for people new to Shellista/Pythonista. I just got Pythonista a few days ago, and I think I might have been scratching my head a bit wondering how to get all those files in there without Git built in... the original Shellista was a simple copy-paste job (you are right-- it's a simple script, but I'm a little absent minded-- that probably wouldn't have been my first thought! :) )

                I found a pure Python implementation of Git called <a href='http://www.samba.org/~jelmer/dulwich/docs/'>Dulwich</a>. There is also a wrapper to that called <a href='https://pypi.python.org/pypi/gittle/0.3.0'>Gittle</a>... I used both of them. Everything except the git push was very simple. With that, I was having all sorts of issues with the authentication. I believe this is because of versioning of Gittle/Dulwich... they seem to be out of sync. I was not able to pair the correct versions, so I ended up writing a monkeypatch for Gittle's push_to() method, which worked in the end. Not ideal at all, but it practically speaking, it works for now.

                1 Reply Last reply Reply Quote 0
                • briarfox
                  briarfox last edited by

                  @transistor1 I got a plugin working for your git, really nice job! I also really like your download setup to import the modules. Very nice. I'd suggest that the downloaded modules be placed into the site-packages folder. I'm new to this whole git thing so I'd rather just contribute what i can to yours. I'm also very noobish when it comes to python.

                  How do you feel about the modular method I used? If you think another path would be better go with that. Let me know how I can help out. In the mean time I'll keep working on the ssh plugin.

                  1 Reply Last reply Reply Quote 0
                  • transistor1
                    transistor1 last edited by

                    @briarfox - thanks! I think your modular method is brilliant, and your code and directory structure is very clean. It is implemented just like a "real" shell, in that commands are individual programs - that's how it should be IMHO. I really feel like the way you implemented it is the smart way to go. If you really want to contribute to my repo, create a branch, and make it more like that :).

                    What I envisioned was somehow taking advantage of the already existing functionality in setuptools to download the plugins and modules -- not sure if this is possible or not. I was going to fork your repo and play around with that when I had a chance. Python isn't my primary language (we are all Microsoft at work), so I'm sure I don't do things the most "Pythonic" way. Suggestions are most definitely welcome.

                    Regarding installation in site-packages: what do you think the policy should be if the user has that package already in their site-packages? I'm a little worried about overwriting a user's own modules. I keep shellista in a separate subfolder of ~, so that all the dependencies download there; almost like a hackish virtualenv.

                    1 Reply Last reply Reply Quote 0
                    • Rothrock42
                      Rothrock42 last edited by

                      @transistor yes I'm (now) using the one from your Git. It is brilliant. Thank you so much. I will give your instructions a go.

                      BTW here is something stupid I did. I was running shellista -- moving, copying, etc. Then I used pythonista's built in "delete this folder" for a directory that was my current directory in shellista. When I came back to shellista it freaked out (I know, very technical term there) and I basically had to restart pythonista

                      I don't know if there is a way to fix that/gracefully recover or if it would even be worth it -- probably not a highly likely error and those who do something so silly probably "deserve it." But just thought I'd bring it up.

                      1 Reply Last reply Reply Quote 0
                      • JonB
                        JonB last edited by

                        Transistor.. Your python shell works running files, but you just can't run scenes. Scenes don't execute until after the main script stops running. clock.py is a scene module.

                        A quick test shows that you can apparently run modules with ui, which opens up lots of possibilities!

                        1 Reply Last reply Reply Quote 0
                        • transistor1
                          transistor1 last edited by

                          @Rothrock42 - You are welcome! I'm really glad it's helpful.

                          When I tried your scenario, I got a "no such file or directory" error. Is that what you got?

                          Opened a ticket <a href='https://github.com/transistor1/shellista/issues/9'>here</a>. Will try to take a look at this later tonight (Eastern Standard time)... Right now I am slacking on other things I'm supposed to be doing!

                          @JonB - that is good to know, thanks!

                          1 Reply Last reply Reply Quote 0
                          • briarfox
                            briarfox last edited by

                            @transistor1 My thought with using the site-packages for the pypi packages was to allow the user to setup Shellista wherever they like and still have access to the pypi packages in all thier apps. If the module/package already exists we'll try using the one that already there? As for any downloaded code, Id say stick with your download into the shellista folder. I'm working on an easy way to include downloads into the plugins. And have the main shellista use your downloading method on plugin load.

                            I added you as a collaborator to ShellistaExt. I'll follow your lead on whichever github you want to use as the official Shellista. We could modularize yours and use it or build yours into ShellistaExt. Let me know what you would prefer.

                            I think Shellista is a must have for pythonista and a easy to empliment plugin system would greatly help on expansion of it.

                            1 Reply Last reply Reply Quote 0
                            • JonB
                              JonB last edited by

                              I added tab completion to transistors repo.

                              The approach I used was to check for tab at end of line. (Actually, 4 spaces, as tab button produces 4spaces in console, not tabs!). You'd start typing, press tab, then press enter. Ui pops up if needed, you select option, but then since we can't update the console input text, I just print the completion, and you continue entering the line.
                              Press enter again to execute, or tab-tab-enter to delete the last argument from the working line.

                              1 Reply Last reply Reply Quote 0
                              • ihf
                                ihf last edited by

                                I tried using shellista to clone the latest shellista with the command:
                                git clone https://github.com/transistor1/shellista.git

                                I get "No module named config". Is this a known bug or is there more to getting this from the repository?

                                1 Reply Last reply Reply Quote 0
                                • JonB
                                  JonB last edited by

                                  Try restarting pythonista ... I seem to remember that previously, it would happen during first download, or perhaps if dulwich did not get installed, but it thought it was installed.

                                  Try deleting your dulwich and gittle folders, especially if you had an older version of shellista.
                                  Then, just do copy paste of shellista from github (go to raw) into a new script, maybe in a separate folder, and run it.

                                  1 Reply Last reply Reply Quote 0
                                  • JadedTuna
                                    JadedTuna last edited by

                                    Hey there. A new idea for shellista.
                                    You could add a folder ~/bin, where executable programs will be stored (actually python files), so users can add their own commands/programms there.

                                    1 Reply Last reply Reply Quote 0
                                    • JonB
                                      JonB last edited by

                                      See the dev-modular branch which has a plugin system.

                                      1 Reply Last reply Reply Quote 0
                                      • FishCo
                                        FishCo @pudquick51 last edited by

                                        @pudquick51 This is annoying me extremely as I haven't found an example etc of this. could you please send an example on how to operate this file with a correct directory etc as when I try to use it, it can never find files which exist.

                                        1 Reply Last reply Reply Quote 0
                                        • JonB
                                          JonB last edited by

                                          Use stash:
                                          https://github.com/ywangd/stash

                                          To list a directory, use ls

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post
                                          Powered by NodeBB Forums | Contributors