mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
cleanup
This commit is contained in:
parent
3740716799
commit
c7a61bbf5d
6 changed files with 44 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
"""Impelements a simple echo command for xonsh."""
|
||||
"""Implements a simple echo command for xonsh."""
|
||||
|
||||
|
||||
def echo(args, stdin, stdout, stderr):
|
||||
|
@ -6,6 +6,9 @@ def echo(args, stdin, stdout, stderr):
|
|||
opts = _echo_parse_args(args)
|
||||
if opts is None:
|
||||
return
|
||||
if opts['help']:
|
||||
print(ECHO_HELP, file=stdout)
|
||||
return 0
|
||||
ender = opts['end']
|
||||
args = map(str, args)
|
||||
if opts['escapes']:
|
||||
|
@ -24,4 +27,18 @@ def _echo_parse_args(args):
|
|||
if '-n' in args:
|
||||
args.remove('-n')
|
||||
out['end'] = ''
|
||||
if '-h' in args or '--help' in args:
|
||||
out['help'] = True
|
||||
return out
|
||||
|
||||
|
||||
EHCO_HELP = """Usage: echo [OPTIONS]... [STRING]...
|
||||
Echo the STRING(s) to standard output.
|
||||
|
||||
-n do not include the trailing newline
|
||||
-e enable interpretation of backslash escapes
|
||||
-E disable interpretation of backslash escapes (default)
|
||||
-h --help display this message and exit
|
||||
|
||||
This version of echo was written in Python for the xonsh project: http://xon.sh
|
||||
Based on echo from GNU coreutils: http://www.gnu.org/software/coreutils/"""
|
||||
|
|
|
@ -5,7 +5,7 @@ import os
|
|||
def pwd(args, stdin, stdout, stderr):
|
||||
"""A pwd implementation"""
|
||||
e = __xonsh_env__['PWD']
|
||||
if '--help' in args:
|
||||
if '-h' in args or '--help' in args:
|
||||
print(PWD_HELP, file=stdout)
|
||||
return 0
|
||||
if '-P' in args:
|
||||
|
@ -14,12 +14,15 @@ def pwd(args, stdin, stdout, stderr):
|
|||
return 0
|
||||
|
||||
|
||||
PWD_HELP = """This version of pwd was written in Python for the xonsh project: http://xon.sh
|
||||
Based on pwd from GNU coreutils: http://www.gnu.org/software/coreutils/
|
||||
|
||||
Usage: pwd [OPTION]...
|
||||
PWD_HELP = """Usage: pwd [OPTION]...
|
||||
Print the full filename of the current working directory.
|
||||
|
||||
-L, --logical use PWD from environment, even if it contains symlinks
|
||||
-P, --physical avoid all symlinks
|
||||
--help display this help and exit"""
|
||||
--help display this help and exit
|
||||
|
||||
This version of pwd was written in Python for the xonsh project: http://xon.sh
|
||||
Based on pwd from GNU coreutils: http://www.gnu.org/software/coreutils/"""
|
||||
|
||||
|
||||
# Not Implemented
|
||||
# -L, --logical use PWD from environment, even if it contains symlinks
|
||||
|
|
|
@ -13,6 +13,10 @@ def tee(args, stdin, stdout, stderr):
|
|||
if '--help' in args:
|
||||
print(TEE_HELP, file=stdout)
|
||||
return 0
|
||||
if stdin is None:
|
||||
msg = "tee was not piped stdin, must have input stream to read from."
|
||||
print(msg, file=stderr)
|
||||
return 1
|
||||
|
||||
errors = False
|
||||
files = []
|
||||
|
|
|
@ -34,11 +34,11 @@ def tty(args, stdin, stdout, stderr):
|
|||
return 3
|
||||
return 0
|
||||
|
||||
TTY_HELP = """This version of tty was written in Python for the xonsh project: http://xon.sh
|
||||
Based on tty from GNU coreutils: http://www.gnu.org/software/coreutils/
|
||||
|
||||
Usage: /usr/bin/tty [OPTION]...
|
||||
TTY_HELP = """Usage: tty [OPTION]...
|
||||
Print the file name of the terminal connected to standard input.
|
||||
|
||||
-s, --silent, --quiet print nothing, only return an exit status
|
||||
--help display this help and exit"""
|
||||
--help display this help and exit
|
||||
|
||||
This version of tty was written in Python for the xonsh project: http://xon.sh
|
||||
Based on tty from GNU coreutils: http://www.gnu.org/software/coreutils/"""
|
||||
|
|
|
@ -15,11 +15,11 @@ def yes(args, stdin, stdout, stderr):
|
|||
return 0
|
||||
|
||||
|
||||
YES_HELP = """This version of yes was written in Python for the xonsh project: http://xon.sh
|
||||
Based on yes from GNU coreutils: http://www.gnu.org/software/coreutils/
|
||||
|
||||
Usage: /usr/bin/yes [STRING]...
|
||||
or: /usr/bin/yes OPTION
|
||||
YES_HELP = """Usage: yes [STRING]...
|
||||
or: yes OPTION
|
||||
Repeatedly output a line with all specified STRING(s), or 'y'.
|
||||
|
||||
--help display this help and exit"""
|
||||
--help display this help and exit
|
||||
|
||||
This version of yes was written in Python for the xonsh project: http://xon.sh
|
||||
Based on yes from GNU coreutils: http://www.gnu.org/software/coreutils/"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Additional core utilites that are implemened in xonsh. The current list
|
||||
"""Additional core utilites that are implemented in xonsh. The current list
|
||||
includes:
|
||||
|
||||
* cat
|
||||
|
|
Loading…
Add table
Reference in a new issue