1"""A pwd implementation for xonsh."""
2import os
3
4
5def pwd(args, stdin, stdout, stderr):
6    """A pwd implementation"""
7    e = __xonsh_env__["PWD"]
8    if "-h" in args or "--help" in args:
9        print(PWD_HELP, file=stdout)
10        return 0
11    if "-P" in args:
12        e = os.path.realpath(e)
13    print(e, file=stdout)
14    return 0
15
16
17PWD_HELP = """Usage: pwd [OPTION]...
18Print the full filename of the current working directory.
19
20  -P, --physical   avoid all symlinks
21      --help       display this help and exit
22
23This version of pwd was written in Python for the xonsh project: http://xon.sh
24Based on pwd from GNU coreutils: http://www.gnu.org/software/coreutils/"""
25
26
27# Not Implemented
28#   -L, --logical    use PWD from environment, even if it contains symlinks
29