// Path: aesh/src/main/java/org/aesh/extensions/less/SimpleFileParser.java
// public class SimpleFileParser implements FileParser {
// 
//     private String pageAsString;
//     private String fileName;
//     private InputStreamReader reader;
// 
//     public SimpleFileParser() {
//     }
// 
//     /**
//      * Read from a specified filename. Also supports gzipped files.
//      *
//      * @param filename File
//      * @throws IOException
//      */
//     public void setFile(String filename) throws IOException {
//         setFile(new File(filename));
//     }
// 
//     /**
//      * Read from a specified file. Also supports gzipped files.
//      *
//      * @param file File
//      * @throws IOException
//      */
//     public void setFile(File file) throws IOException {
//         if(!file.isFile())
//             throw new IllegalArgumentException(file+" must be a file.");
//         else {
//             if(file.getName().endsWith("gz"))
//                 initGzReader(file);
//             else
//                 initReader(file);
//         }
//     }
// 
//     public void setFile(InputStream inputStream) {
//         reader = new InputStreamReader(inputStream);
//     }
// 
//     public void setFile(InputStream inputStream, String fileName) {
//         reader = new InputStreamReader(inputStream);
//         this.fileName = fileName;
//     }
// 
// 
//     /**
//      * Read a file resouce located in a jar
//      *
//      * @param fileName name
//      */
//     public void setFileFromAJar(String fileName) {
//         InputStream is = this.getClass().getResourceAsStream(fileName);
//         if(is != null) {
//             this.fileName = fileName;
//             reader = new InputStreamReader(is);
//         }
//     }
// 
//     private void initReader(File file) throws FileNotFoundException {
//         fileName = file.getAbsolutePath();
//         reader = new FileReader(file);
//     }
// 
//     public void readPageAsString(String pageAsString) {
//         this.pageAsString = pageAsString;
//     }
// 
//     @Override
//     public String getName() {
//         if(fileName != null)
//             return fileName;
//         else
//             return "STREAM";
//     }
// 
//     private void initGzReader(File file) throws IOException {
//         fileName = file.getAbsolutePath();
//         GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(file));
//         reader = new InputStreamReader(gzip);
//     }
// 
//     @Override
//     public List<String> loadPage(int columns) throws IOException {
//         List<String> lines = new ArrayList<String>();
//         //read file and save each line in a list
//         if(reader != null) {
//             BufferedReader br = new BufferedReader(reader);
//             try {
//                 String line = br.readLine();
// 
//                 while (line != null) {
//                     if(line.length() > columns) {
//                         //split the line in the size of column
//                         for(String s : line.split("(?<=\\G.{"+columns+"})"))
//                             lines.add(s);
//                     }
//                     else
//                         lines.add(line);
//                     line = br.readLine();
//                 }
//             }
//             finally {
//                 br.close();
//             }
//         }
//         else if(pageAsString != null) {
//             for(String s : pageAsString.split("\n")) {
//                 for(String s2 : s.split("(?<=\\G.{" + columns + "})"))
//                     lines.add(s2);
//             }
//         }
// 
//         return lines;
//     }
// 
// }


import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Arguments;
import org.aesh.command.man.FileParser;
import org.aesh.command.man.TerminalPage;
import org.aesh.extensions.less.SimpleFileParser;
import org.aesh.io.Resource;
import org.aesh.readline.action.KeyAction;
import org.aesh.readline.terminal.Key;
import org.aesh.terminal.utils.ANSI;
import org.aesh.terminal.utils.Config;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.aesh.command.CommandException;
            commandInvocation.getShell().write(ANSI.NORMAL_BACKGROUND);
        }
    }

    private String getPercentDisplayed() {
        double row = topVisibleRow  + rows;
        if(row > this.page.size())
            row  = this.page.size();
        return String.valueOf((int) ((row / this.page.size()) * 100));
    }

    public void displayHelp() throws IOException {
        commandInvocation.getShell().writeln(Config.getLineSeparator()
                +"Usage: more [options] file...");
    }

    private int getNumber() {
        if(number.length() > 0)
            return Integer.parseInt(number.toString());
        else
            return 1;
    }

    private void clearNumber() {
        number = new StringBuilder();
    }

    @Override
    public CommandResult execute(CommandInvocation commandInvocation) throws CommandException {
        this.commandInvocation = commandInvocation;
// Path: aesh/src/main/java/org/aesh/extensions/less/SimpleFileParser.java
// public class SimpleFileParser implements FileParser {
// 
//     private String pageAsString;
//     private String fileName;
//     private InputStreamReader reader;
// 
//     public SimpleFileParser() {
//     }
// 
//     /**
//      * Read from a specified filename. Also supports gzipped files.
//      *
//      * @param filename File
//      * @throws IOException
//      */
//     public void setFile(String filename) throws IOException {
//         setFile(new File(filename));
//     }
// 
//     /**
//      * Read from a specified file. Also supports gzipped files.
//      *
//      * @param file File
//      * @throws IOException
//      */
//     public void setFile(File file) throws IOException {
//         if(!file.isFile())
//             throw new IllegalArgumentException(file+" must be a file.");
//         else {
//             if(file.getName().endsWith("gz"))
//                 initGzReader(file);
//             else
//                 initReader(file);
//         }
//     }
// 
//     public void setFile(InputStream inputStream) {
//         reader = new InputStreamReader(inputStream);
//     }
// 
//     public void setFile(InputStream inputStream, String fileName) {
//         reader = new InputStreamReader(inputStream);
//         this.fileName = fileName;
//     }
// 
// 
//     /**
//      * Read a file resouce located in a jar
//      *
//      * @param fileName name
//      */
//     public void setFileFromAJar(String fileName) {
//         InputStream is = this.getClass().getResourceAsStream(fileName);
//         if(is != null) {
//             this.fileName = fileName;
//             reader = new InputStreamReader(is);
//         }
//     }
// 
//     private void initReader(File file) throws FileNotFoundException {
//         fileName = file.getAbsolutePath();
//         reader = new FileReader(file);
//     }
// 
//     public void readPageAsString(String pageAsString) {
//         this.pageAsString = pageAsString;
//     }
// 
//     @Override
//     public String getName() {
//         if(fileName != null)
//             return fileName;
//         else
//             return "STREAM";
//     }
// 
//     private void initGzReader(File file) throws IOException {
//         fileName = file.getAbsolutePath();
//         GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(file));
//         reader = new InputStreamReader(gzip);
//     }
// 
//     @Override
//     public List<String> loadPage(int columns) throws IOException {
//         List<String> lines = new ArrayList<String>();
//         //read file and save each line in a list
//         if(reader != null) {
//             BufferedReader br = new BufferedReader(reader);
//             try {
//                 String line = br.readLine();
// 
//                 while (line != null) {
//                     if(line.length() > columns) {
//                         //split the line in the size of column
//                         for(String s : line.split("(?<=\\G.{"+columns+"})"))
//                             lines.add(s);
//                     }
//                     else
//                         lines.add(line);
//                     line = br.readLine();
//                 }
//             }
//             finally {
//                 br.close();
//             }
//         }
//         else if(pageAsString != null) {
//             for(String s : pageAsString.split("\n")) {
//                 for(String s2 : s.split("(?<=\\G.{" + columns + "})"))
//                     lines.add(s2);
//             }
//         }
// 
//         return lines;
//     }
// 
// }


// Path: aesh/src/main/java/org/aesh/extensions/more/More.java
import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Arguments;
import org.aesh.command.man.FileParser;
import org.aesh.command.man.TerminalPage;
import org.aesh.extensions.less.SimpleFileParser;
import org.aesh.io.Resource;
import org.aesh.readline.action.KeyAction;
import org.aesh.readline.terminal.Key;
import org.aesh.terminal.utils.ANSI;
import org.aesh.terminal.utils.Config;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.aesh.command.CommandException;

            commandInvocation.getShell().write(ANSI.NORMAL_BACKGROUND);
        }
    }

    private String getPercentDisplayed() {
        double row = topVisibleRow  + rows;
        if(row > this.page.size())
            row  = this.page.size();
        return String.valueOf((int) ((row / this.page.size()) * 100));
    }

    public void displayHelp() throws IOException {
        commandInvocation.getShell().writeln(Config.getLineSeparator()
                +"Usage: more [options] file...");
    }

    private int getNumber() {
        if(number.length() > 0)
            return Integer.parseInt(number.toString());
        else
            return 1;
    }

    private void clearNumber() {
        number = new StringBuilder();
    }

    @Override
    public CommandResult execute(CommandInvocation commandInvocation) throws CommandException {
        this.commandInvocation = commandInvocation;
        loader = new SimpleFileParser();