<gh_stars>0
# Copyright 2021 by <NAME>, <EMAIL>
# All rights reserved.
# This file is part of the Nessaid CLI Framework, nessaid_cli python package
# and is released under the "MIT License Agreement". Please see the LICENSE
# file included as part of this package.
#

from nessaid_cli.cmd import NessaidCmd

class TestCmd(NessaidCmd):
    def get_token_classes(self):
        return []

    def do_test(self):
        r"""
        "test"
        """
        print("Normal Function")

    async def do_async(self):
        r"""
        "async"
        """
        print("Async Function")

    def do_blocking_input(self, input_str):
        r"""
        "blocking-input"
        <<
            $input_str = input("cli: ");
            print("Cli Code Input (cli print):", $input_str);
        >>
        """
        inp = await self.input("python: ", show_char=False)
        print("Cli Code Input (python print):", input_str)
        print("Python Code Input:", inp)

    async def do_get_input(self, input_str):
        r"""
        "async-input"
        <<
            $input_str = input("cli: ", False);
            print("Cli Code Input (cli print):", $input_str);
        >>
        """
        inp = await self.input("python: ", show_char=True)
        print("Cli Code Input (python print):", input_str)
        print("Python Code Input:", inp)

if __name__ == '__main__':
    cmd = TestCmd(prompt="nessaid-cmd # ", show_grammar=True)
    #show_grammar will print the generated grammar specification
    cmd.run(intro="Starting Nessaid CMD Demo")

# Copyright 2021 by <NAME>, <EMAIL>
# All rights reserved.
# This file is part of the Nessaid CLI Framework, nessaid_cli python package
# and is released under the "MIT License Agreement". Please see the LICENSE
# file included as part of this package.
#

from nessaid_cli.cmd import NessaidCmd

class TestCmd(NessaidCmd):
    def get_token_classes(self):
        return []

    def do_test(self):
        r"""
        "test"
        """
        print("Normal Function")

    async def do_async(self):
        r"""
        "async"
        """
        print("Async Function")

    def do_blocking_input(self, input_str):
        r"""
        "blocking-input"
        <<
            $input_str = input("cli: ");
            print("Cli Code Input (cli print):", $input_str);
        >>
        """
        inp = await self.input("python: ", show_char=False)
        print("Cli Code Input (python print):", input_str)
        print("Python Code Input:", inp)

    async def do_get_input(self, input_str):
        r"""
        "async-input"
        <<
            $input_str = input("cli: ", False);
            print("Cli Code Input (cli print):", $input_str);
        >>
        """
        inp = await self.input("python: ", show_char=True)
        print("Cli Code Input (python print):", input_str)
        print("Python Code Input:", inp)

if __name__ == '__main__':
    cmd = TestCmd(prompt="nessaid-cmd # ", show_grammar=True)
    #show_grammar will print the generated grammar specification
    cmd.run(intro="Starting Nessaid CMD Demo")
# Copyright 2021 by <NAME>, <EMAIL> # All rights reserved. # This file is part of the Nessaid CLI Framework, nessaid_cli python package # and is released under the "MIT License Agreement". Please see the LICENSE # file included as part of this package. # "test" "async" "blocking-input"         <<             $input_str = input("cli: ");             print("Cli Code Input (cli print):", $input_str);         >> "async-input"         <<             $input_str = input("cli: ", False);             print("Cli Code Input (cli print):", $input_str);         >> # ", show_grammar=True) #show_grammar will print the generated grammar specification