GithubHelp home page GithubHelp logo

ergonomica / ergonomica Goto Github PK

View Code? Open in Web Editor NEW
810.0 25.0 27.0 8.35 MB

🖥️ a cross-platform modern shell.

Home Page: http://ergonomica.readthedocs.io

License: GNU General Public License v2.0

Python 100.00%
terminal shell python functional-programming cli bash-alternative lisp-variant lisp scheme

ergonomica's Introduction

Ergonomica

WARNING: master on this repository is not the same as a stable release! Currently, this software is purely experimental, as I am cleaning it up substantially after a long hiatus. However, if you find bugs, feel free to file an issue.

Ergonomica is a cross-platform shell language implemented in Python that aims to redesign the shell in a more standard, easy-to-use, and powerful way than traditional shells. It is designed as a fully-functional S-expression based language with a few traditional shell features such as flags and piping to combine the functionality of a Lisp with the convenience of the UNIX shell.

ergonomica's People

Contributors

codebam avatar dhyanpatel avatar hexdump avatar iplusplus42 avatar jgaver avatar jonathanslenders avatar lschumm avatar webmaven avatar yuce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ergonomica's Issues

[Linux] - Requires one to run ergo_setup before first run.

Followed the installation instructions posted here and found that the documentation requires one more step to complete installation on Linux.

Might have to add this in your wiki installation page for linux:


Finally, configure ergonomica for first time use by:

ergo_setup.sh

btw - Nice project. Snappy suggestions 👍

Windows support

CMD is awful. Python-based shell should be cross-platform.

No module named pyvim.entry_points.run_pyvim

Installed on OSX as per instructions

Get the error:

Traceback (most recent call last):
  File "/usr/local/bin/ergonomica.py", line 55, in <module>
    from lib.lang.error_handler import handle_runtime_error
  File "/usr/local/Cellar/ergonomica/1.1.3/bin/lib/lang/error_handler.py", line 20, in <module>
    from lib.load.load_commands import verbs
  File "/usr/local/Cellar/ergonomica/1.1.3/bin/lib/load/load_commands.py", line 23, in <module>
    from lib.lib import verbs
  File "/usr/local/Cellar/ergonomica/1.1.3/bin/lib/lib/__init__.py", line 22, in <module>
    verbs.update(__import__('lib.lib.'+item, globals(), locals(), ['object'], 0).verbs)
  File "/usr/local/Cellar/ergonomica/1.1.3/bin/lib/lib/edit.py", line 36, in <module>
    from pyvim.entry_points.run_pyvim import run
ImportError: No module named pyvim.entry_points.run_pyvim

Tried installing pyvim at version 0.0.20 but still no luck.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal)

When I press space, it will throw error
$ Exception in thread Thread-16: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/home/wpm/.linuxbrew/Cellar/ergonomica/1.1.4/bin/lib/prompt_toolkit/intn completions = list(buffer.completer.get_completions(document, complete_even) File "/home/wpm/.linuxbrew/Cellar/ergonomica/1.1.4/bin/lib/interface/completes for result in complete(self.verbs, document.text): File "/home/wpm/.linuxbrew/Cellar/ergonomica/1.1.4/bin/lib/interface/completee options = [i for i in options if i.startswith(last_word)] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal)

quit doesnt work

[ergo: nayhd in /}> quit
Traceback (most recent call last):
File "ergonomica.py", line 55, in
STDOUT = [x for x in STDOUT if x != None]
TypeError: 'NoneType' object is not iterable

Suplemon not cross-platform

No module named '_curses'
after installation

Windows 10 bash - works well after linux way of installation. But the native support will be perfect.

Unhelpful Help

Explain how to use the different commands, and how the terminal works in general.

Formalize error handling

Right now, many commands simply print out "[ergo: ExceptionName]: ...." instead of actually raising an ErgonomicaError. Some even print that to stdout! As a result, handling such errors is inconsistent.

`No module named colorama` in Travis CI Builds

target = 'colorama.ansitowin32'
    def _importer(target):
        components = target.split('.')
        import_path = components.pop(0)
>       thing = __import__(import_path)
E       ImportError: No module named colorama

Suplemon is executed a second time after quitting it

Hi, and many thanks for the awesome project! It caught me by total surprise when I noticed my editor (suplemon) was included. Background: I cloned master, installed the dependencies, and ran python3 ergonomica.py. Here's the bug I came across:

At first I just tried the edit command, but got this:

$ edit
[ergo: EditorError]: No such editor 'emacs'.

That's fine I thought and added EDITOR suplemon to my .ergo_profile. Then I tried the edit command again, and sure enough suplemon fired up, cool!

The bug: when I quit suplemon, the terminal flashed for a split second and suplemon was relaunched 😕 I quit it again, and it stayed closed. This doesn't happen when I use vim. Any idea what could be causing this? The return code for both vim and suplemon is 0.

clear command doesn't work

[ergo: nayhd in /}> clear

Traceback (most recent call last):
File "ergonomica.py", line 55, in
STDOUT = [x for x in STDOUT if x != None]
TypeError: 'NoneType' object is not iterable

ergo - use /bin/sh instead of bash

Hello,

Is there any need to launch ergo from bash? /bin/bash isn't a portable path and this make ergonomica to depend on bash.

Using /bin/sh is portable and lighter.

install with brew on macOS Sierra fails

Here is the last few lines of the install output

==> Installing mtklabs/tap/ergonomica 
==> Cloning https://github.com/ergonomica/ergonomica.git
Cloning into '/Users/petar/Library/Caches/Homebrew/ergonomica--git'...
remote: Counting objects: 101, done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 101 (delta 20), reused 46 (delta 10), pack-reused 0
Receiving objects: 100% (101/101), 121.86 KiB | 0 bytes/s, done.
Resolving deltas: 100% (20/20), done.
==> Checking out branch master
Error: No such file or directory - lib/lib/version.py

Make Windows2Ergo parser

Currently, when some command is un-runnable in Ergonomica, it defaults to the system shell (only bash supported for now), and parses custom Ergonomica syntax down to that bash. There should be a parser that goes from Ergonomica to Windows (Powershell or BATCH) syntax.

Lonely (valid) operators returning OperatorError

The Issue

[lschumm@/Users/lschumm/.ergo]
$ (map)
[ergo: OperatorError]: No such operator 'map'.
[lschumm@/Users/lschumm/.ergo]
$ (filter)
[ergo: OperatorError]: No such operator 'filter'.

(map) is a valid operator. Some other sort of error should be raised; this is misleading

Info

ergonomica commit 20763da.

help command not working

[ergo: nayhd in /}> help
Traceback (most recent call last):
File "ergonomica.py", line 53, in
STDOUT = verbs.verbs[BLOCKS[i][0][0]](LAST, {s.split(":")[0]:s.split(":")[1] for s in BLOCKS[i][2]})
TypeError: Help() takes exactly 1 argument (2 given)

Ugly help

[ergo: nayhd in /Coding/}> help
{'echo': <function echo at 0x7ff7c111d2a8>, 'quit': <function Quit at 0x7ff7c1397ed8>, 'cp': <function cp at 0x7ff7c111d230>, 'help': <function Help at 0x7ff7c111d398>, 'clear': <function clear at 0x7ff7c111d320>, 'move': <function mv at 0x7ff7c111d1b8>, 'cd': <function cd at 0x7ff7c1397f50>, 'mv': <function mv at 0x7ff7c111d1b8>, 'exit': <function Quit at 0x7ff7c1397ed8>, 'ls': <function ls at 0x7ff7c111d050>, 'print': <function echo at 0x7ff7c111d2a8>, 'rm': <function rm at 0x7ff7c111d0c8>, 'yes': <function yes at 0x7ff7c1397e60>, 'copy': <function cp at 0x7ff7c111d230>, 'find': <function find at 0x7ff7c111d140>}
echo : Echos a phrase
quit : Quits the ergonomica shell.
cp : Copy files.
help : ergonomica help
clear : Clears the screen
move : Move files.
cd : Changes to a directory
mv : Move files.
exit : Quits the ergonomica shell.
ls : List files in a directory.
print : Echos a phrase
rm : Remove files.
yes : Returns a 'y'.
copy : Copy files.
find : Finds a file with a pattern

ls working weirdly

[ergo: nayhd in /}> ls
STDOUT IS ['lost+found', 'dev', 'boot', 'usr', 'lib64', 'run', 'proc', 'media', 'snap', 'vmlinuz', 'root', 'home', 'initrd.img', 'srv', 'tmp', 'bin', 'sbin', 'sys', 'mnt', 'opt', 'initrd.img.old', 'var', 'etc', 'vmlinuz.old', 'cdrom', 'lib']
l
o
s
t
+
f
o
u
n
d
d
e
v
b
o
o
t
u
s
r
l
i
b
6
4
r
u
n
p
r
o
c
m
e
d
i
a
s
n
a
p
v
m
l
i
n
u
z
r
o
o
t
h
o
m
e
i
n
i
t
r
d
.
i
m
g
s
r
v
t
m
p
b
i
n
s
b
i
n
s
y
s
m
n
t
o
p
t
i
n
i
t
r
d
.
i
m
g
.
o
l
d
v
a
r
e
t
c
v
m
l
i
n
u
z
.
o
l
d
c
d
r
o
m
l
i
b

cd

cd doesn't continue from current direction.
Example: I'm cd'ed into Desktop.
I try doing cd [/Coding/"] (A folder on my desktop)
I get no such file or directory.

cd not working, throwing an error

[ergo: nayhd in /}> cd [/home/nayhd/Desktop/Coding/]
Traceback (most recent call last):
File "ergonomica.py", line 55, in
STDOUT = [x for x in STDOUT if x != None]
TypeError: 'NoneType' object is not iterable

Error in Arch Linux

Running ergonomica in Arch Linux produces the following error. This is most likely because Arch Linux uses Python 3 by default. This could be fixed by changing the shebang to #!/usr/bin/env python2

$ ergonomica
Traceback (most recent call last):
  File "/home/codebam/.linuxbrew/bin/ergonomica.py", line 266, in <module>
    STDIN = prompt(unicode(PROMPT), history=history, completer=ErgonomicaCompleter(verbs))
NameError: name 'unicode' is not defined

Travis CI build broken after d323e05

The log gives

Worker information

hostname: i-03bc520-precise-production-2-worker-org-docker.travisci.net:40c0c808-8220-4d15-870b-44654306af79

version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f

instance: 4805c94:travis:python

startup: 434.916264ms
system_info

Build system information

Build language: python

Build group: stable

Build dist: precise

Build id: 203680842

Job id: 203680843

travis-build version: 2b04abe3b

Build image provisioning date and time

Thu Feb  5 15:09:33 UTC 2015

Operating System Details

Distributor ID:	Ubuntu

Description:	Ubuntu 12.04.5 LTS

Release:	12.04

Codename:	precise

Linux Version

3.13.0-29-generic

Cookbooks Version

a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e

GCC version

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Copyright (C) 2011 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM version

clang version 3.4 (tags/RELEASE_34/final)

Target: x86_64-unknown-linux-gnu

Thread model: posix

Pre-installed Ruby versions

ruby-1.9.3-p551

Pre-installed Node.js versions

v0.10.36

Pre-installed Go versions

1.4.1

Redis version

redis-server 2.8.19

riak version

2.0.2

MongoDB version

MongoDB 2.4.12

CouchDB version

couchdb 1.6.1

Neo4j version

1.9.4

RabbitMQ Version

3.4.3

ElasticSearch version

1.4.0

Installed Sphinx versions

2.0.10

2.1.9

2.2.6

Default Sphinx version

2.2.6

Installed Firefox version

firefox 31.0esr

PhantomJS version

1.9.8

ant -version

Apache Ant(TM) version 1.8.2 compiled on December 3 2011

mvn -version

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)

Maven home: /usr/local/maven

Java version: 1.7.0_76, vendor: Oracle Corporation

Java home: /usr/lib/jvm/java-7-oracle/jre

Default locale: en_US, platform encoding: ANSI_X3.4-1968

OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"

fix.CVE-2015-7547

$ export DEBIAN_FRONTEND=noninteractive

Reading package lists...

Building dependency tree...

Reading state information...

The following extra packages will be installed:

  libc-bin libc-dev-bin libc6-dev

Suggested packages:

  glibc-doc

The following packages will be upgraded:

  libc-bin libc-dev-bin libc6 libc6-dev

4 upgraded, 0 newly installed, 0 to remove and 258 not upgraded.

Need to get 8,840 kB of archives.

After this operation, 14.3 kB disk space will be freed.

Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.15 [2,943 kB]

Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.15 [84.7 kB]

Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.15 [1,177 kB]

Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.15 [4,636 kB]

Fetched 8,840 kB in 0s (31.9 MB/s)

Preconfiguring packages ...

(Reading database ... 72431 files and directories currently installed.)

Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.15_amd64.deb) ...

Unpacking replacement libc6-dev ...

Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.15_amd64.deb) ...

Unpacking replacement libc-dev-bin ...

Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.15_amd64.deb) ...

Unpacking replacement libc-bin ...

Processing triggers for man-db ...

Setting up libc-bin (2.15-0ubuntu10.15) ...

(Reading database ... 72430 files and directories currently installed.)

Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.15_amd64.deb) ...

Unpacking replacement libc6 ...

Setting up libc6 (2.15-0ubuntu10.15) ...

Setting up libc-dev-bin (2.15-0ubuntu10.15) ...

Setting up libc6-dev (2.15-0ubuntu10.15) ...

Processing triggers for libc-bin ...

ldconfig deferred processing now taking place
git.checkout

0.42s$ git clone --depth=50 --branch=master https://github.com/ergonomica/ergonomica.git ergonomica/ergonomica

Cloning into 'ergonomica/ergonomica'...

remote: Counting objects: 718, done.

remote: Compressing objects: 100% (410/410), done.

remote: Total 718 (delta 329), reused 645 (delta 286), pack-reused 0

Receiving objects: 100% (718/718), 702.25 KiB | 0 bytes/s, done.

Resolving deltas: 100% (329/329), done.

Checking connectivity... done.

$ cd ergonomica/ergonomica

$ git checkout -qf d323e055fd9aa6d604d33a80e1145394c468080e

This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.

If you require sudo, add 'sudo: required' to your .travis.yml

See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.

0.00s$ source ~/virtualenv/python2.7/bin/activate

$ python --version

Python 2.7.9

$ pip --version

pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7)
install

2.57s$ pip install -r requirements.txt

Requirement already satisfied (use --upgrade to upgrade): pytest in /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (from -r requirements.txt (line 1))

Collecting ptpython (from -r requirements.txt (line 2))

  Downloading ptpython-0.36-py2-none-any.whl (46kB)

    100% |################################| 49kB 4.4MB/s 

Collecting pyflakes (from -r requirements.txt (line 3))

  Downloading pyflakes-1.5.0-py2.py3-none-any.whl (225kB)

    100% |################################| 225kB 2.6MB/s 

Collecting pyvim (from -r requirements.txt (line 4))

  Downloading pyvim-0.0.20-py2-none-any.whl (42kB)

    100% |################################| 45kB 2.3MB/s 

Collecting colorama (from -r requirements.txt (line 5))

  Downloading colorama-0.3.7-py2.py3-none-any.whl

Requirement already satisfied (use --upgrade to upgrade): py>=1.4.25 in /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (from pytest->-r requirements.txt (line 1))

Collecting jedi>=0.9.0 (from ptpython->-r requirements.txt (line 2))

  Downloading jedi-0.10.0-py2.py3-none-any.whl (186kB)

    100% |################################| 188kB 2.2MB/s 

Collecting docopt (from ptpython->-r requirements.txt (line 2))

  Downloading docopt-0.6.2.tar.gz

Collecting pygments (from ptpython->-r requirements.txt (line 2))

  Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB)

    100% |################################| 843kB 653kB/s 

Collecting prompt-toolkit<2.0.0,>=1.0.0 (from ptpython->-r requirements.txt (line 2))

  Downloading prompt_toolkit-1.0.13-py2-none-any.whl (247kB)

    100% |################################| 249kB 2.2MB/s 

Collecting six>=1.9.0 (from prompt-toolkit<2.0.0,>=1.0.0->ptpython->-r requirements.txt (line 2))

  Downloading six-1.10.0-py2.py3-none-any.whl

Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.0->ptpython->-r requirements.txt (line 2))

  Downloading wcwidth-0.1.7-py2.py3-none-any.whl

Installing collected packages: wcwidth, six, prompt-toolkit, pygments, docopt, jedi, colorama, pyvim, pyflakes, ptpython

  Running setup.py install for docopt

Successfully installed colorama-0.3.7 docopt-0.6.2 jedi-0.10.0 prompt-toolkit-1.0.13 ptpython-0.36 pyflakes-1.5.0 pygments-2.2.0 pyvim-0.0.20 six-1.10.0 wcwidth-0.1.7

0.01s$ mkdir /home/travis/.ergo

The command "mkdir /home/travis/.ergo" exited with 0.

0.00s$ mkdir /home/travis/.ergo/packages

The command "mkdir /home/travis/.ergo/packages" exited with 0.

0.00s$ touch /home/travis/.ergo/.ergo_profile

The command "touch /home/travis/.ergo/.ergo_profile" exited with 0.

0.00s$ touch /home/travis/.ergo/.ergo_history

The command "touch /home/travis/.ergo/.ergo_history" exited with 0.

0.30s$ python -m unittest discover

�]2;ergonomica�[ergo: ArgumentError] Use the -s argument to run strings.

E.......................

======================================================================

ERROR: test_addline (tests.test.TestStringMethods)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/ergonomica/ergonomica/tests/test.py", line 68, in test_addline

    ergo('addline "TESTING this feature\n" "once again testing this feature" {file:"test-addline"}')

  File "/home/travis/build/ergonomica/ergonomica/ergonomica/ergo.py", line 102, in ergo

    return map(ergo, get_code_blocks(stdin))

  File "/home/travis/build/ergonomica/ergonomica/ergonomica/ergo.py", line 218, in ergo

    stdout = [handle_runtime_error(blocks[i], error)]

  File "/home/travis/build/ergonomica/ergonomica/ergonomica/lib/lang/error_handler.py", line 48, in handle_runtime_error

    raise error

ErgonomicaError: [ergo: ArgumentError]: No file set for addline.

----------------------------------------------------------------------

Ran 24 tests in 0.025s

FAILED (errors=1)

The command "python -m unittest discover" exited with 1.

Done. Your build exited with 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.