Make echo and example available in new shell
This commit is contained in:
parent
7e708ba4ab
commit
7b5b8b4d06
@ -5,7 +5,6 @@ import readline
|
|||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from psh.commands import registered_cmds
|
from psh.commands import registered_cmds
|
||||||
import psh.example_cmd
|
|
||||||
|
|
||||||
DEFAULT_HISTORY_FILE = "~/.psh_history"
|
DEFAULT_HISTORY_FILE = "~/.psh_history"
|
||||||
|
|
||||||
@ -26,7 +25,8 @@ def parse_cmd(potential_cmd):
|
|||||||
if cmd_name not in registered_cmds:
|
if cmd_name not in registered_cmds:
|
||||||
return "RawCommand({})".format(shlex.split(potential_cmd))
|
return "RawCommand({})".format(shlex.split(potential_cmd))
|
||||||
else:
|
else:
|
||||||
return "{0}({1})".format(cmd_name,str(args))
|
cls = registered_cmds[cmd_name].__name__
|
||||||
|
return "{0}({1})".format(cls, str(args))
|
||||||
|
|
||||||
|
|
||||||
def parse_cmds(raw_input_line):
|
def parse_cmds(raw_input_line):
|
||||||
|
|||||||
@ -30,4 +30,3 @@ class Echo(BaseCommand):
|
|||||||
for line in input_generator:
|
for line in input_generator:
|
||||||
yield line
|
yield line
|
||||||
return output_generator
|
return output_generator
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from psh.formatters import *
|
from psh.formatters import *
|
||||||
|
|
||||||
|
from psh.example_cmd import Echo, Example
|
||||||
from psh.raw_commands import RawCommand
|
from psh.raw_commands import RawCommand
|
||||||
|
|
||||||
# Load all of the commands in the path into the global namespace as raw
|
# Load all of the commands in the path into the global namespace as raw
|
||||||
|
|||||||
Reference in New Issue
Block a user