# Path: linux_story/commands_real.py
# def shell_command(real_loc, line, command_word=""):
#     """
#     Suitable for launching commands which don't involve curses.
# 
#     Args:
#         real_loc (str): the current location of the user.
#         line (str): line user typed not including the command word.
#         command_word (str): command you want to run (e.g. ls).
# 
#     Returns:
#         bool: False if error, True otherwise.
#     """
# 
#     if command_word:
#         line = command_word + " " + line
# 
#     line = line.replace('~', fake_home_dir)
#     args = line.split(" ")
# 
#     # run the command
#     p = subprocess.Popen(args, cwd=real_loc,
#                          stdout=subprocess.PIPE,
#                          stderr=subprocess.PIPE)
#     stdout, stderr = p.communicate()
# 
#     if stderr:
#         print stderr.strip().replace(fake_home_dir, '~')
#         return False
# 
#     if stdout:
#         if command_word == "cat":
#             print stdout
# 
#         else:
#             print stdout.strip()
# 
#     # notifying the SoundManager about the command that was run
#     sounds_manager.on_command_run(args)
# 
#     # should this return stdout?
#     return True
# 
# Path: linux_story/story/terminals/terminal_ls.py
# class TerminalLs(KanoCmd):
#     terminal_commands = ["ls"]
# 
#     def do_ls(self, line):
#         return ls(self._location.get_real_path(), line)
# 
#     def complete_ls(self, text, line, begidx, endidx):
#         return self._autocomplete_files(text, line, begidx, endidx)


from linux_story.commands_real import shell_command
from linux_story.story.terminals.terminal_ls import TerminalLs
# terminal_cat.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# The a terminal for one of the challenges




class TerminalCat(TerminalLs):
    terminal_commands = ["ls", "cat"]

    def do_cat(self, line):

# Path: linux_story/commands_real.py
# def shell_command(real_loc, line, command_word=""):
#     """
#     Suitable for launching commands which don't involve curses.
# 
#     Args:
#         real_loc (str): the current location of the user.
#         line (str): line user typed not including the command word.
#         command_word (str): command you want to run (e.g. ls).
# 
#     Returns:
#         bool: False if error, True otherwise.
#     """
# 
#     if command_word:
#         line = command_word + " " + line
# 
#     line = line.replace('~', fake_home_dir)
#     args = line.split(" ")
# 
#     # run the command
#     p = subprocess.Popen(args, cwd=real_loc,
#                          stdout=subprocess.PIPE,
#                          stderr=subprocess.PIPE)
#     stdout, stderr = p.communicate()
# 
#     if stderr:
#         print stderr.strip().replace(fake_home_dir, '~')
#         return False
# 
#     if stdout:
#         if command_word == "cat":
#             print stdout
# 
#         else:
#             print stdout.strip()
# 
#     # notifying the SoundManager about the command that was run
#     sounds_manager.on_command_run(args)
# 
#     # should this return stdout?
#     return True
# 
# Path: linux_story/story/terminals/terminal_ls.py
# class TerminalLs(KanoCmd):
#     terminal_commands = ["ls"]
# 
#     def do_ls(self, line):
#         return ls(self._location.get_real_path(), line)
# 
#     def complete_ls(self, text, line, begidx, endidx):
#         return self._autocomplete_files(text, line, begidx, endidx)


# Path: linux_story/story/terminals/terminal_cat.py
from linux_story.commands_real import shell_command
from linux_story.story.terminals.terminal_ls import TerminalLs

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




class TerminalCat(TerminalLs):
    terminal_commands = ["ls", "cat"]

    def do_cat(self, line):

        shell_command(self._get_real_path(), line, "cat")