-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Sergix/dev
Release v0.3.0
- Loading branch information
Showing
12 changed files
with
655 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Changelog entry: | ||
|
||
[6/4/2017-20:08 0.3.0 Sergix] | ||
Release 0.3.0 has been pushed with the associated documentation and other data. | ||
Documentation now includes a section covering commands that JTerm provides. | ||
The Client/Server classes are included in the packaged source, although they are not actually used in the release executable; see associated release documentation for more details. | ||
Pushed updates to Git. | ||
|
||
Full changes include: | ||
- Created "Client" class | ||
- Added "connect" command; called with `Client.Connect()` function | ||
- NOT FUNCTIONING in this release; source is included | ||
- Created "Server" class | ||
- Added "server" command; called with `Server.Start()` function | ||
- NOT FUNCTIONING in this release; source is included | ||
- Created "Window" class | ||
- Added "window" command; called with `new Window()` function | ||
- Added the "md" command (Make Directory) that calls the new `Dir.NewDir()` function | ||
- Added the "del" command (DELete) that calls the new `Files.Delete()` function | ||
- In-development source code is now pushed to the `dev` branch on the repository, which will be merged with `master` on release | ||
- Inputed commands convert to all lowercase | ||
- `Write` class has been removed; member function moved to `Files` class | ||
- The current directory will always end with a single "forward slash" (e.g. `/usr/home/`) | ||
- Other minor fixes | ||
|
||
More information provided in published release documentation. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# JTerm Documentation v0.3.0 | ||
|
||
## Table of Contents | ||
``` | ||
I. Table of Contents | ||
II. Overview | ||
III. Build Targets | ||
IV. Changelog | ||
V. New Features | ||
A. Commands | ||
B. Client/Server | ||
VI. Active Command List | ||
``` | ||
|
||
## Overview | ||
This document provides information on changes included in release version "0.3.0". The JTerm project is still far from its official release, but the project has had enough changes to include it as a new pre-release version. This document was written by @Sergix and reviewed by @NCSGeek. | ||
|
||
## Build Targets | ||
``` | ||
[VERSION] [FILE] [STATE] | ||
0.1.0 jterm-v0.1.0.jar OK | ||
0.2.0 jterm-v0.2.0.jar OK | ||
0.2.1 jterm-v0.2.1.jar OK | ||
0.3.0 jterm-v0.3.0.jar OK | ||
``` | ||
|
||
## Changelog | ||
- Created "Client" class | ||
- Added "connect" command; called with `Client.Connect()` function | ||
- NOT FUNCTIONING in this release; source is included | ||
- Created "Server" class | ||
- Added "server" command; called with `Server.Start()` function | ||
- NOT FUNCTIONING in this release; source is included | ||
- Created "Window" class | ||
- Added "window" command; called with `new Window()` function | ||
- Added the "md" command (Make Directory) that calls the new `Dir.NewDir()` function | ||
- Added the "del" command (DELete) that calls the new `Files.Delete()` function | ||
- In-development source code is now pushed to the `dev` branch on the repository, which will be merged with `master` on release | ||
- Inputed commands convert to all lowercase | ||
- `Write` class has been removed; member function moved to `Files` class | ||
- The current directory will always end with a single "forward slash" (e.g. `/usr/home/`) | ||
- Other minor fixes | ||
|
||
## New Features | ||
|
||
### Commands | ||
The commands `connect`, `server`, `md`, `del`, and `window` have been added to JTerm. The syntax for these commands are as follows: | ||
``` | ||
connect [-h] [-p port] address | ||
server [-h] port | ||
md [-h] name | ||
del [-h] file/directory | ||
window [-h] [-r] [-w width] [-l height] [-t title] | ||
``` | ||
`connect` AND `server` ARE NOT FUNCTIONABLE IN THIS RELEASE. | ||
`-h` ALWAYS displays the command's help information in the console. `-r`, used for the `window` command, toggles resizability for the created window. | ||
|
||
### Client/Server | ||
As mentioned before, a new Client/Server interface has been written for JTerm. However, this functionality has too many issues to be released yet. The source code and classes are packaged into the source build, as well as the JAR, but it is not able to be run. Any presented fixes to the issues are welcome. | ||
|
||
## Active Command List | ||
- `help` - displays information about JTerm | ||
- `quit` - Exits the JTerm application | ||
- `write [-h] filename` - Opens an input prompt that will write the data to the new file named `filename` | ||
- `dir [-f] [-h] [directory]` - Dispays extensive directory information, including files and subdirectories | ||
- `-f` - toggles minimal output | ||
- `cd [-h] directory` - Changes the directory to the location specified | ||
- `pwd` - prints the current working directory | ||
- `echo [-h] input` - outputs the input on a new line | ||
- `del [-h] file/directory` - deletes the specified file or directory | ||
- `md [-h] name` - creates a new directory | ||
- `window [-h] [-r] [-w width] [-l height] [-t title]` - creates a new GUI window | ||
- `-r` - toggles resizability | ||
- `-w` - specifies window width | ||
- `-l` - specifies window height | ||
- `-t` - sets the name of the window, displayed in the title bar | ||
|
||
> JTerm 0.3.0 | ||
> `jterm-v0.3.0.jar` | ||
> This project and its source are held under the GNU General Public License, located in the LICENSE file in the project's directory. | ||
> (c) 2017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package main.java.com.jterm; | ||
|
||
import java.io.*; | ||
import java.net.Socket; | ||
import java.util.ArrayList; | ||
|
||
public class Client implements Runnable { | ||
|
||
private static BufferedReader input; | ||
|
||
public void run() { | ||
|
||
while (true) { | ||
try { | ||
String output = Client.input.readLine(); | ||
if (output != null) | ||
System.out.println(output); | ||
|
||
} catch (IOException ioe) { | ||
return; | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
public static void Connect(ArrayList<String> options) { | ||
|
||
String address = "0.0.0.0"; | ||
String portInput = "80"; | ||
boolean next = false; | ||
|
||
for (String option: options) { | ||
if (option.equals("-h")) | ||
{ | ||
System.out.println("Command syntax:\n\tconnect [-h] [-p port] address\n\nConnect to the specified IP address using TCP/IP. Default address is \"0.0.0.0\". Default port is 80."); | ||
return; | ||
|
||
} | ||
else if (option.equals("-p")) | ||
{ | ||
next = true; | ||
|
||
} | ||
else if (next) | ||
{ | ||
portInput = option; | ||
next = false; | ||
|
||
} | ||
else | ||
{ | ||
address = option; | ||
|
||
} | ||
|
||
} | ||
|
||
int i = 0; | ||
int port = 0; | ||
|
||
while( i < portInput.length()) | ||
{ | ||
port *= 10; | ||
port += portInput.charAt(i++) - '0'; | ||
|
||
} | ||
|
||
try { | ||
System.out.println("Connecting to " + address + ":" + port); | ||
|
||
Socket connection = new Socket(address, port); | ||
InputStream input = connection.getInputStream(); | ||
OutputStream output = connection.getOutputStream(); | ||
BufferedReader bufferedSocketInput = new BufferedReader(new InputStreamReader(input)); | ||
|
||
Client.input = bufferedSocketInput; | ||
|
||
Client client = new Client(); | ||
Thread readThread = new Thread(client); | ||
readThread.start(); | ||
|
||
System.out.println("Connected to server. Enter a blank line to quit. Reading for input..."); | ||
|
||
while (true) { | ||
BufferedReader bufferedSocketOutput = new BufferedReader(new InputStreamReader(System.in), 1); | ||
String line = bufferedSocketOutput.readLine(); | ||
|
||
if (line.equals("")) | ||
break; | ||
output.write(line.getBytes()); | ||
|
||
output.close(); | ||
bufferedSocketOutput.close(); | ||
|
||
} | ||
|
||
connection.close(); | ||
|
||
} | ||
catch (IOException ioe) | ||
{ | ||
System.out.println("Connection severed."); | ||
|
||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package main.java.com.jterm; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.util.ArrayList; | ||
|
||
public class Files { | ||
|
||
/* | ||
* WriteFile() void | ||
* | ||
* Get input and write it to a file. | ||
* | ||
* ArrayList<String> options - command options | ||
* | ||
* -h | ||
* Prints help information | ||
*/ | ||
public static void WriteFile(ArrayList<String> options) { | ||
|
||
String filename = ""; | ||
|
||
for (String option: options) | ||
{ | ||
if (option.equals("-h")) | ||
{ | ||
System.out.println("Command syntax:\n\twrite [-h] filename\n\nOpens an input prompt in which to write text to a new file."); | ||
return; | ||
|
||
} | ||
else | ||
{ | ||
filename = JTerm.currentDirectory + option; | ||
|
||
} | ||
|
||
} | ||
|
||
try { | ||
System.out.println("Enter file contents:\n"); | ||
BufferedReader inputStream = new BufferedReader(new InputStreamReader(System.in), 1); | ||
String output = inputStream.readLine(); | ||
|
||
FileWriter fileWriter = new FileWriter(filename); | ||
fileWriter.write(output); | ||
fileWriter.close(); | ||
|
||
} | ||
catch (IOException ioe) | ||
{ | ||
System.out.println(ioe); | ||
|
||
} | ||
|
||
} | ||
|
||
/* | ||
* Delete() void | ||
* | ||
* Delete the specified file or directory. | ||
* | ||
* ArrayList<String> options - command options | ||
* | ||
* -h | ||
* Prints help information | ||
*/ | ||
public static void Delete(ArrayList<String> options) { | ||
|
||
String filename = ""; | ||
|
||
for (String option: options) | ||
{ | ||
if (option.equals("-h")) | ||
{ | ||
System.out.println("Command syntax:\n\tdel [-h] file/directory\n\nDeletes the specified file or directory."); | ||
return; | ||
|
||
} | ||
else | ||
{ | ||
filename = JTerm.currentDirectory + option; | ||
|
||
} | ||
|
||
} | ||
|
||
File dir = new File(filename); | ||
if (!dir.exists()) { | ||
System.out.println("ERROR: File/directory \"" + options.get(options.size() - 1) + "\" does not exist."); | ||
return; | ||
|
||
} | ||
|
||
dir.delete(); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.