# Path: linux_story/commands_real.py
# def launch_application(real_path, line, command_word=""):
#     '''
#     This is appropriate for commands which use curses (e.g. less).
# 
#     Args:
#         real_path (str): the current location of the user.
#         line (str): the line (not including the command word) the user entered.
#         command_word (str): the command that we want to launch.
# 
#     Returns:
#         None.
#     '''
# 
#     line = line.replace('~', fake_home_dir)
#     line = " ".join([command_word] + line.split(" "))
# 
#     p = subprocess.Popen(line, cwd=real_path, shell=True)
#     stdout, stderr = p.communicate()
# 
#     if stdout:
#         print stdout.strip()
# 
#     if stderr:
#         print stderr.strip()
# 
# Path: linux_story/story/terminals/terminal_mv.py
# class TerminalMv(TerminalCd):
#     terminal_commands = ["ls", "cat", "cd", "mv"]
# 
#     def do_mv(self, line):
#         if "*" in line:
#             launch_application(self._location.get_real_path(), line, "mv")
#         else:
#             shell_command(self._location.get_real_path(), line, "mv")
# 
#     def complete_mv(self, text, line, begidx, endidx):
#         completions = self._autocomplete_files(text, line, begidx, endidx)
#         return completions


from linux_story.commands_real import launch_application
from linux_story.story.terminals.terminal_mv import TerminalMv
# terminal_echo.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# A terminal for one of the challenges




class TerminalEcho(TerminalMv):
    terminal_commands = ["ls", "cat", "cd", "mv", "echo"]

    def do_echo(self, line):

# Path: linux_story/commands_real.py
# def launch_application(real_path, line, command_word=""):
#     '''
#     This is appropriate for commands which use curses (e.g. less).
# 
#     Args:
#         real_path (str): the current location of the user.
#         line (str): the line (not including the command word) the user entered.
#         command_word (str): the command that we want to launch.
# 
#     Returns:
#         None.
#     '''
# 
#     line = line.replace('~', fake_home_dir)
#     line = " ".join([command_word] + line.split(" "))
# 
#     p = subprocess.Popen(line, cwd=real_path, shell=True)
#     stdout, stderr = p.communicate()
# 
#     if stdout:
#         print stdout.strip()
# 
#     if stderr:
#         print stderr.strip()
# 
# Path: linux_story/story/terminals/terminal_mv.py
# class TerminalMv(TerminalCd):
#     terminal_commands = ["ls", "cat", "cd", "mv"]
# 
#     def do_mv(self, line):
#         if "*" in line:
#             launch_application(self._location.get_real_path(), line, "mv")
#         else:
#             shell_command(self._location.get_real_path(), line, "mv")
# 
#     def complete_mv(self, text, line, begidx, endidx):
#         completions = self._autocomplete_files(text, line, begidx, endidx)
#         return completions


# Path: linux_story/story/terminals/terminal_echo.py
from linux_story.commands_real import launch_application
from linux_story.story.terminals.terminal_mv import TerminalMv

# terminal_echo.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# A terminal for one of the challenges




class TerminalEcho(TerminalMv):
    terminal_commands = ["ls", "cat", "cd", "mv", "echo"]

    def do_echo(self, line):

        launch_application(self._location.get_real_path(), line, "echo")