Package org.jboss.aesh.terminal

Examples of org.jboss.aesh.terminal.Shell


        }

        Resource currentWorkingDirectory = commandInvocation.getAeshContext().getCurrentWorkingDirectory();
        for (Resource r : arguments) {

            Shell shell = commandInvocation.getShell();
            Resource resource = r.resolve(currentWorkingDirectory).get(0);
            if (dir) {
                rmDir(resource, commandInvocation);
            } else {
                rmFile(resource, commandInvocation);
View Full Code Here


        return CommandResult.SUCCESS;
    }

    private void rmFile(Resource r, CommandInvocation commandInvocation) throws InterruptedException {
        Shell shell = commandInvocation.getShell();
        if (r.exists()) {
            if (r.isLeaf()) {
                if (interactive) {
                    shell.out().println("remove regular file '" + r.getName() + "' ? (y/n)");
                    CommandOperation operation = commandInvocation.getInput();
                    if (operation.getInputKey() == Key.y) {
                        r.delete();
                    }
                } else {
                    r.delete();
                }
                if (verbose) {
                    shell.out().println("removed '" + r.getName() + "'");
                }
            } else if (r.isDirectory()) {
                shell.out().println("cannot remove '" + r.getName() + "': Is a directory");
            }
        }
    }
View Full Code Here

        }
    }


    private void rmDir(Resource r, CommandInvocation commandInvocation) throws InterruptedException {
        Shell shell = commandInvocation.getShell();
        if (r.exists()) {
            if (r.isDirectory()) {
                if (interactive) {
                    shell.out().println("remove directory '" + r.getName() + "' ? (y/n)");
                    CommandOperation operation = commandInvocation.getInput();
                    if (operation.getInputKey() == Key.y) {
                        r.delete();
                    }
                } else {
                    r.delete();
                }

                if (verbose) {
                    shell.out().println("removed directory: '" + r.getName() + "'");
                }
            }
        }
    }
View Full Code Here

    private List<String> arguments;

    @Override
    public CommandResult execute(CommandInvocation commandInvocation) throws IOException {

        Shell shell = commandInvocation.getShell();

        if (help || arguments == null || arguments.isEmpty()) {
            shell.out().println(commandInvocation.getHelpInfo("echo"));
            return CommandResult.SUCCESS;
        }

        String stdout = "";
        for (String s : arguments) {
            stdout += s + " ";
        }
        stdout = stdout.trim();

        shell.out().println(stdout);

        return CommandResult.SUCCESS;
    }
View Full Code Here

            return CommandResult.SUCCESS;
        }

        for (Resource f : arguments) {
            Resource currentWorkingDirectory = commandInvocation.getAeshContext().getCurrentWorkingDirectory();
            Shell shell = commandInvocation.getShell();

            Resource pathResolved = f.resolve(currentWorkingDirectory).get(0);

            if (parents || f.getName().contains(Config.getPathSeparator())) {
                makeDirs(arguments, pathResolved, shell);
View Full Code Here

TOP

Related Classes of org.jboss.aesh.terminal.Shell

Copyright © 2018 www.massapicom. 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.