transistor1 / shellista

shellista - iOS shell written for Pythonista
https://omz-forums.appspot.com/pythonista/post/5302343285342208
78 stars 18 forks source link

Shellista

An iOS Shell Written for Pythonista

On 24 Nov 2012, user "pudquick" released the initial version of Shellista on the Pythonista forums, to help Pythonista users get around the fact that there is no shell available on iOS devices. Since the original post, many in the Pythonista community have contributed to improve the functionality of Shellista. From pudquick's initial post:

Commands and features:

Examples of advanced usage:

This is an intial (rough) port of a script I put together for another python interpreter on the app store. I'll be porting the rest of the commands soon: unzip, ungzip, untar, wget/curl (basic download functionality) Enjoy :)

For the interested programmer: This script uses a pure python re-implementation of some of the more basic globbing of "bash" which I wrote up myself. It's a little different than shlex, glob, or shlex+glob in that matching happens in a single parsing run through. It depends on glob for wildcard handling, but only after my code has already handled all character escapes and word parsing. An example where shlex/glob fails: In the current working directory are three files: 'test apple', 'peach', 'test a' (with an asterisk as part of the name) The command to parse is the string: rm 'test a' peach shlex interprets it as ['rm', 'test a', 'peach'], which glob then interprets the file portion as a match of three files: ['test apple', 'test a', 'peach']. shlex unfortunately clobbers quotes that in a bash environment specify that the special character should be treated as a literal. This would result in deletion of all 3 files. With my parser, the single quotes around 'test a' are interpreted bash-style to mean escaping of the special character '' - disabling it as a wildcard match and turning it into a literal match, resulting in the deletion of only two files: 'test a*' and 'peach'.


New Additions: