#!/usr/bin/python3
# -*- Python -*-
# -*- coding: utf-8 -*-

'''rtshell

Copyright (C) 2009-2014
    Geoffrey Biggs
    RT-Synthesis Research Group
    Intelligent Systems Research Institute,
    National Institute of Advanced Industrial Science and Technology (AIST),
    Japan
    All rights reserved.
Licensed under the Eclipse Public License -v 1.0 (EPL)
http://www.opensource.org/licenses/eclipse-1.0.txt

Command to show the current value of the current working directory environment
variable.

'''


import os
import sys


from rtshell.path import ENV_VAR


def main(argv):
    if len(argv) > 1 and (argv[1] == '--help' or argv[1] == '-h'):
        print('Print the name of the current rtshell working directory.', file=sys.stderr)
        return 0
    if ENV_VAR in os.environ:
        print(os.environ[ENV_VAR])
    else:
        print('/')
    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv))


# vim: tw=79

