Skip to content

Commit

Permalink
Extremely Stable Version of Shell
Browse files Browse the repository at this point in the history
  • Loading branch information
shocoladka committed Sep 30, 2014
1 parent 960d913 commit d4eb276
Show file tree
Hide file tree
Showing 15 changed files with 2,090 additions and 2,088 deletions.
2,070 changes: 1,035 additions & 1,035 deletions src/ru/fizteh/fivt/students/mrshoco/shell/bin/workbench.xmi

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;
import java.util.Scanner;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

/**
* class Command.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;
import java.io.InputStream;
Expand All @@ -9,21 +9,22 @@
public class CpCommand extends Command {
/**
* {@inheritDoc}
*
* @see Command#CpCommand(String[])
*/
CpCommand(final String[] cmd) {
super(cmd);
}

/**
* {@inheritDoc}
* @see Command#run()
*/
public final void run() throws Exception {
if (args.length < 3 || (args[1] == "-r" && args.length < 4)) {
if (args.length < 3 || (args[1].equals("-r") && args.length < 4)) {
throw new Exception("cp: missing file operand");
}
File src, dest;
File src;
File dest;

if (args[1].equals("-r")) {
src = new File(System.getProperty("user.dir"), args[2]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

/**
* .
Expand All @@ -22,8 +22,8 @@ public final void run() throws Exception {
}

try {
new CpCommand(new String[] { "cp", "-r", args[1], args[2] }).run();
new RmCommand(new String[] { "rm", "-r", args[1] }).run();
new CpCommand(new String[] {"cp", "-r", args[1], args[2]}).run();
new RmCommand(new String[] {"rm", "-r", args[1]}).run();
} catch (Exception e) {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

/**
* .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.io.File;

Expand All @@ -18,7 +18,7 @@ public class RmCommand extends Command {
* .
*/
public final void run() throws Exception {
if (args.length < 2 || (args[1] == "-r" && args.length < 3)) {
if (args.length < 2 || (args[1].equals("-r") && args.length < 3)) {
throw new Exception("rm: missing operand");
}
File file;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shell_util;
package util;

import java.util.Arrays;
import java.util.Scanner;
Expand Down Expand Up @@ -26,7 +26,8 @@ private ShellMain() {
*/
public static void main(final String[] args) {
if (args.length != 0) {
int i = 0, j = 0;
int i = 0;
int j = 0;
for (i = 0; i <= args.length; i++) {
if (i == args.length || args[i].equals(";")) {
try {
Expand Down
2,070 changes: 1,035 additions & 1,035 deletions src/ru/fizteh/fivt/students/mrshoco/shell/workbench.xmi

Large diffs are not rendered by default.

0 comments on commit d4eb276

Please sign in to comment.