Galaxie Shell 0.2.6 documentation


Navigation:   | Index   | Search   | Top   | Up   |
Table of Content: |

© Copyright 2020-2024, Galaxie Shell Team.

Top » Module code » glxshell.glxsh

Source code for glxshell.glxsh

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys

from glxshell.lib.argparse import ArgumentParser
from glxshell.lib.path import isfile
from glxshell.lib.ush import GLXUsh

# https://fallout.fandom.com/wiki/Pip-OS_v7.1.0.8
# https://fallout.fandom.com/wiki/Terminal
# https://fallout.fandom.com/wiki/Unified_Operating_System
# https://fallout.fandom.com/wiki/RETROS_BIOS
# https://fallout.fandom.com/wiki/MF_Boot_Agent

parser_glxsh = ArgumentParser(
    prog="glxsh",
    add_help=True,
)
parser_glxsh.add_argument(
    "command",
    nargs="?",
    help="optional commands or file to run, if no commands given, enter an interactive shell",
)
parser_glxsh.add_argument(
    "command_args",
    nargs="...",
    help="if commands is not a file use optional arguments for commands",
)


[docs] def main(): if len(sys.argv) > 1: args = parser_glxsh.parse_args(sys.argv[1:]) if args.help: parser_glxsh.print_help() return 0 if isfile(args.command): try: with open(args.command) as rcFile: for line in rcFile.readlines(): line = line.rstrip() if len(line) > 0 and line[0] != "#": exit_code = GLXUsh().onecmdhooks("%s" % line) except IOError: exit_code = 1 else: return exit_code else: return GLXUsh().onecmdhooks("%s %s" % (args.command, " ".join(args.command_args))) else: return GLXUsh().cmdloop()
if __name__ == "__main__": sys.exit(main())

Top » Module code » glxshell.glxsh

© Copyright 2020-2024, Galaxie Shell Team.
This page is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0).
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

Last updated on None.
Created using Sphinx 8.0.2.