Skip to content

Commit

Permalink
Change paths to import from ergonomica itself, not the pip installed …
Browse files Browse the repository at this point in the history
…version; minor documentation fixes
  • Loading branch information
lschumm committed Feb 21, 2017
1 parent 8d03590 commit 492a045
Show file tree
Hide file tree
Showing 32 changed files with 91 additions and 52 deletions.
27 changes: 27 additions & 0 deletions EXAMPLES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
========
Examples
========

include image here

Ergonomica still has the same shell features, so

.. code::
cd ..
will, for example, go up a directory.

.. code::
cd \~
will go to your home directory.


Ergonomica also supports `if`, `while`, and `for`. For example, if you wanted to increment a number for every file in a directory, you could do

.. code::
for ls:
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ See `installation page`_.

Credits
=======
`@lschumm`_, Lead Developer. `@appleinventor`_, `@schtolc`_,`@dpp2000`_, Developers.
`@lschumm`_, Lead Developer. `@appleinventor`_, `@schtolc`_, `@dpp2000`_, Developers.

Ergonomica couldn't work without:

Expand Down Expand Up @@ -61,8 +61,7 @@ Ergonomica couldn't work without:

.. _@tartley: https://github.com/tartley/colorama

.. |logo| image:: https://asciinema.org/a/0wvbn49vqlgwo0ui8f78ibz3p.png
:target: https://asciinema.org/a/0wvbn49vqlgwo0ui8f78ibz3p
.. |logo| image:: https://raw.github.com/ergonomica/ergonomica/master/logo.png

.. |homebrew| image:: https://img.shields.io/badge/homebrew-1.1.3-orange.svg
:target: https://github.com/mtklabs/homebrew-tap
Expand Down
32 changes: 17 additions & 15 deletions ergonomica/ergo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,20 @@
import sys

from lib.lang.blocks import are_multiple_blocks, get_code_blocks
from ergonomica.lib.lang.parser import tokenize
from ergonomica.lib.lang.operator import get_operator, run_operator
from ergonomica.lib.lang.statement import get_statement
from ergonomica.lib.lang.arguments import get_args_kwargs, get_func
from ergonomica.lib.lang.environment import Environment
from ergonomica.lib.lang.error_handler import handle_runtime_error
from ergonomica.lib.lang.pipe import StaticPipeline
from ergonomica.lib.lang.stdout import handle_stdout
from ergonomica.lib.lang.bash import run_bash
from ergonomica.lib.lang.ergo2bash import ergo2bash
from ergonomica.lib.load.load_commands import verbs
from ergonomica.lib.misc.arguments import print_arguments
from ergonomica.lib.misc.arguments import process_arguments
from ergonomica.lib.interface.completer import ErgonomicaCompleter

from lib.lang.parser import tokenize
from lib.lang.operator import get_operator, run_operator
from lib.lang.statement import get_statement
from lib.lang.arguments import get_args_kwargs, get_func
from lib.lang.environment import Environment
from lib.lang.error_handler import handle_runtime_error
from lib.lang.pipe import StaticPipeline
from lib.lang.stdout import handle_stdout
from lib.lang.bash import run_bash
from lib.lang.ergo2bash import ergo2bash
from lib.load.load_commands import verbs
from lib.misc.arguments import print_arguments
from lib.misc.arguments import process_arguments
from lib.interface.completer import ErgonomicaCompleter

from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
Expand Down Expand Up @@ -190,6 +189,9 @@ def ergo(stdin, depth=0, thread=0):
out = out.replace(str(depth) + "{}", item)
stdout += ergo(out.strip(), depth+1)

elif statement == "def":
res = " ".join(tokenize(stdin.split(":")[0])[0][1:])

else:
if blocks[i] in ENV.aliases:
stdout = ergo(ENV.aliases[blocks[i]])
Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lang/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# pylint doesn't know that `from lib.lib...` is run from the above dir
# pylint: disable=import-error

from ergonomica.lib.util.util import run_command
from lib.util.util import run_command

def run_bash(env, stdin, pipe):
try:
Expand Down
7 changes: 6 additions & 1 deletion ergonomica/lib/lang/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"""
[lib/lang/blocks.py
Code block parsing.
"""

from lib.lang.error import ErgonomicaError

def get_code_blocks(string):
lines = string.split("\n")
Expand All @@ -17,7 +19,10 @@ def get_code_blocks(string):
elif line[0] != " ":
blocks.append(line)
else:
blocks[-1] += line[3:] + "\n"
if (not line.startswith(" ")) and (line.startswith(" ")):
raise ErgonomicaError("[ergo: SyntaxError]: Incorrect indentation on line '%s'." % line)
else:
blocks[-1] += line[3:] + "\n"


return blocks
Expand Down
8 changes: 7 additions & 1 deletion ergonomica/lib/lang/ergo2bash.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from ergonomica.lib.lang.parser import tokenize
"""
[lib/lang/ergo2bash.py]
Ergonomica to Bash syntax converter.
"""

from lib.lang.parser import tokenize

def ergo2bash(string):
tokens = tokenize(string)
Expand Down
10 changes: 5 additions & 5 deletions ergonomica/lib/lang/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import difflib
import traceback

from ergonomica.lib.lang.parser import tokenize
from ergonomica.lib.load.load_commands import verbs
from ergonomica.lib.lang.operator import get_operator
from ergonomica.lib.lang.operator import operators
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.parser import tokenize
from lib.load.load_commands import verbs
from lib.lang.operator import get_operator
from lib.lang.operator import operators
from lib.lang.error import ErgonomicaError

def get_error_message(BLOCK):
"""Print an error message for a block."""
Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lang/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import re
import itertools
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

def get_operator(string):
"""Find functional-programming operators in a string.
Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@

for item in commands:
if (item != "__init__.py") and (item[-4:] != ".pyc"):
verbs.update(__import__('ergonomica.lib.lib.'+item, globals(), locals(), ['object'], 0).verbs)
verbs.update(__import__('lib.lib.'+item, globals(), locals(), ['object'], 0).verbs)
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/addline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""

import os
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Defines the "alias" command.
"""

from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

import os
from ergonomica.lib.util.util import run_command
from lib.util.util import run_command

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys
import os
import re
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Defines the "echo"/"print" command.
"""

from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import subprocess


from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

sys.path[0] = os.path.join(sys.path[0], "lib", "pyvim")

Expand Down
4 changes: 2 additions & 2 deletions ergonomica/lib/lib/ergo_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
Defines the "ergo_help" command.
"""

from ergonomica.lib.lang.error import ErgonomicaError
from ergonomica.lib.globalization.globalization import globalization_query
from lib.lang.error import ErgonomicaError
from lib.globalization.globalization import globalization_query

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

import os
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import os
import fnmatch
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/fish.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import os
from ergonomica.lib.util.util import run_command
from lib.util.util import run_command

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import os
import sys
from ergonomica.lib.load.load_config import load_config
from lib.load.load_config import load_config

verbs = {}

Expand Down
4 changes: 2 additions & 2 deletions ergonomica/lib/lib/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import re
import sys
import datetime
from ergonomica.lib.lang.stat import creation_date
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.stat import creation_date
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/mkdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import os
import errno
import shutil
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Defines the "multiply" command.
"""

from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

import re
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import os
import shutil
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/size.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

import os
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import shutil
import subprocess
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""

import sys
from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/whoami.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Defines the "whoami" command.
"""

from ergonomica.lib.lang.error import ErgonomicaError
from lib.lang.error import ErgonomicaError

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/lib/zsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

import os
from ergonomica.lib.util.util import run_command
from lib.util.util import run_command

verbs = {}

Expand Down
2 changes: 1 addition & 1 deletion ergonomica/lib/load/load_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sys # for importing from ~/.ergo/packages
import importlib # for programatic importing

from ergonomica.lib.lib import verbs
from lib.lib import verbs

packages_path = os.path.join(os.path.expanduser("~"), ".ergo", "packages")

Expand Down
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 492a045

Please sign in to comment.