Examples of AeshLine


Examples of org.jboss.aesh.parser.AeshLine

            //2. use the buffer from the next operation to read file to buffer
            //3. switch redirection operation with next one
            if(operations.size() > 0) {
                ConsoleOperation nextOperation = operations.remove(0);
                if( nextOperation.getBuffer().length() > 0) {
                    AeshLine line = Parser.findAllWords(nextOperation.getBuffer());
                    currentOperation = new ConsoleOperation(nextOperation.getControlOperator(), op.getBuffer());

                    File readFile = new File(Parser.switchEscapedSpacesToSpacesInWord(line.getWords().get(0)));
                    if(readFile.isFile()) {
                        standardStream.setStdIn(new BufferedInputStream(
                                new FileInputStream(readFile)));
                        output = new ConsoleOperation(nextOperation.getControlOperator(),op.getBuffer());
                    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

        return new CompleteOperation(getAeshContext(), buffer, cursor);
    }

    private void persistRedirection(String fileName, ControlOperator redirection) throws IOException {
        AeshLine line = Parser.findAllWords(fileName);
        if(line.getWords().size() > 1) {
            if(settings.isLogging())
                logger.info(settings.getName()+": can't redirect to more than one file."+Config.getLineSeparator());
            err().print(settings.getName() + ": can't redirect to more than one file." + Config.getLineSeparator());
            return;
        }
        //this is safe since we check that buffer do contain text earlier
        else {
            fileName = line.getWords().get(0);
            if(fileName.startsWith("~/")) {
                fileName = Config.getHomeDir()+fileName.substring(1);
            }
        }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

     * @param ignoreRequirements if we should ignore
     * @return CommandLine
     */
    @Override
    public CommandLine parse(String line, boolean ignoreRequirements) {
        AeshLine aeshLine = Parser.findAllWords(line);
        if(aeshLine.getWords().size() > 0) {
            if(command.getName().equals(aeshLine.getWords().get(0)))
                return parse(aeshLine.getWords(), ignoreRequirements);
        }
        else if(aeshLine.getStatus() != ParserStatus.OK)
            return new CommandLine(new CommandLineParserException(aeshLine.getErrorMessage()));

        return new CommandLine(new CommandLineParserException("Command:"+ command +", not found in: "+line));
    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

            //2. use the buffer from the next operation to read file to buffer
            //3. switch redirection operation with next one
            if(operations.size() > 0) {
                ConsoleOperation nextOperation = operations.remove(0);
                if( nextOperation.getBuffer().length() > 0) {
                    AeshLine line = Parser.findAllWords(nextOperation.getBuffer());
                    currentOperation = new ConsoleOperation(nextOperation.getControlOperator(), op.getBuffer());

                    File readFile = new File(Parser.switchEscapedSpacesToSpacesInWord(line.getWords().get(0)));
                    if(readFile.isFile()) {
                        standardStream.setStdIn(new BufferedInputStream(
                                new FileInputStream(readFile)));
                        output = new ConsoleOperation(nextOperation.getControlOperator(),op.getBuffer());
                    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

        return new CompleteOperation(getAeshContext(), buffer, cursor);
    }

    private void persistRedirection(String fileName, ControlOperator redirection) throws IOException {
        AeshLine line = Parser.findAllWords(fileName);
        if(line.getWords().size() > 1) {
            if(settings.isLogging())
                logger.info(settings.getName()+": can't redirect to more than one file."+Config.getLineSeparator());
            err().print(settings.getName() + ": can't redirect to more than one file." + Config.getLineSeparator());
            return;
        }
        //this is safe since we check that buffer do contain text earlier
        else {
            fileName = line.getWords().get(0);
            if(fileName.startsWith("~/")) {
                fileName = Config.getHomeDir()+fileName.substring(1);
            }
        }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

     * @param ignoreRequirements if we should ignore
     * @return CommandLine
     */
    @Override
    public CommandLine parse(String line, boolean ignoreRequirements) {
        AeshLine aeshLine = Parser.findAllWords(line);
        if(aeshLine.getWords().size() > 0) {
            if(command.getName().equals(aeshLine.getWords().get(0)))
                return parse(aeshLine.getWords(), ignoreRequirements);
        }
        else if(aeshLine.getStatus() != ParserStatus.OK)
            return new CommandLine(new CommandLineParserException(aeshLine.getErrorMessage()));

        return new CommandLine(new CommandLineParserException("Command:"+ command +", not found in: "+line));
    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

            //2. use the buffer from the next operation to read file to buffer
            //3. switch redirection operation with next one
            if(operations.size() > 0) {
                ConsoleOperation nextOperation = operations.remove(0);
                if( nextOperation.getBuffer().length() > 0) {
                    AeshLine line = Parser.findAllWords(nextOperation.getBuffer());
                    currentOperation = new ConsoleOperation(nextOperation.getControlOperator(), op.getBuffer());

                    File readFile = new File(Parser.switchEscapedSpacesToSpacesInWord(line.getWords().get(0)));
                    if(readFile.isFile()) {
                        standardStream.setStdIn(new BufferedInputStream(
                                new FileInputStream(readFile)));
                        output = new ConsoleOperation(nextOperation.getControlOperator(),op.getBuffer());
                    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

        return new CompleteOperation(buffer, cursor);
    }

    private void persistRedirection(String fileName, ControlOperator redirection) throws IOException {
        AeshLine line = Parser.findAllWords(fileName);
        if(line.getWords().size() > 1) {
            if(settings.isLogging())
                logger.info(settings.getName()+": can't redirect to more than one file."+Config.getLineSeparator());
            err().print(settings.getName() + ": can't redirect to more than one file." + Config.getLineSeparator());
            return;
        }
        //this is safe since we check that buffer do contain text earlier
        else {
            fileName = line.getWords().get(0);
            if(fileName.startsWith("~/")) {
                fileName = Config.getHomeDir()+fileName.substring(1);
            }
        }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

     * @param ignoreRequirements if we should ignore
     * @return CommandLine
     */
    @Override
    public CommandLine parse(String line, boolean ignoreRequirements) {
        AeshLine aeshLine = Parser.findAllWords(line);
        if(aeshLine.getWords().size() > 0) {
            if(command.getName().equals(aeshLine.getWords().get(0)))
                return parse(aeshLine.getWords(), ignoreRequirements);
        }
        else if(aeshLine.getStatus() != ParserStatus.OK)
            return new CommandLine(new CommandLineParserException(aeshLine.getErrorMessage()));

        return new CommandLine(new CommandLineParserException("Command:"+ command +", not found in: "+line));
    }
View Full Code Here

Examples of org.jboss.aesh.parser.AeshLine

            //2. use the buffer from the next operation to read file to buffer
            //3. switch redirection operation with next one
            if(operations.size() > 0) {
                ConsoleOperation nextOperation = operations.remove(0);
                if( nextOperation.getBuffer().length() > 0) {
                    AeshLine line = Parser.findAllWords(nextOperation.getBuffer());
                    currentOperation = new ConsoleOperation(nextOperation.getControlOperator(), op.getBuffer());

                    Resource fileRelativePath =
                            getAeshContext().getCurrentWorkingDirectory().newInstance(
                                    Parser.switchEscapedSpacesToSpacesInWord(line.getWords().get(0)));

                    Resource readFile = fileRelativePath.resolve( context.getCurrentWorkingDirectory()).get(0);
                    if(readFile.isLeaf()) {
                        standardStream.setStdIn(new BufferedInputStream( readFile.read()));
                        output = new ConsoleOperation(nextOperation.getControlOperator(),op.getBuffer());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.