Skip to content

Commit 5e87755

Browse files
committed
Merge branch 'release/0.3.0'
2 parents 7c26feb + 0908176 commit 5e87755

File tree

12 files changed

+228
-251
lines changed

12 files changed

+228
-251
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
.idea/
2-
build/
3-
dist/
4-
docs/
2+
target/
53
*.iml

CHANGELOG.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

4-
The format is based on [Keep a Changelog][1] and this project adheres to
5-
[Semantic Versioning 2.0.0][2].
5+
The format is based on [Keep a Changelog][1] and this project adheres to [Semantic Versioning 2.0.0][2].
6+
7+
## [0.3.0][4] (2022-06-08)
8+
9+
* Added
10+
* A Maven POM to make it easier to add this project as a dependency.
11+
* Method for reading boolean input.
612

713
## [0.1.0][3] (2019-09-11)
8-
### Added
9-
* The class `Terminal` with static methods for writing to and reading from
10-
standard input and output.
14+
15+
* Added
16+
* The class `Terminal` with static methods for writing to and reading from standard input and output.
1117

1218

1319
[1]: https://keepachangelog.com/en/1.0.0/
1420
[2]: https://semver.org/
1521
[3]: https://github.com/olivertwistor/java-tui/releases/tag/v0.1.0
22+
[4]: https://github.com/olivertwistor/java-tui/releases/tag/v0.3.0

CONTRIBUTING.md

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,36 @@
1-
# How to contribute to this project
2-
I'm happy that you are interested in contributing to this project. The open
3-
source community depends on people like you, and together we can make this
4-
project as good as it can possibly be. Thank you!
1+
# Contributing to this project
52

6-
This document describes, first of all, code of conduct (a very important read),
7-
then some ideas of with what you may contribute and, last but not least,
8-
explanations on what you must do to start working on an issue and get your work
9-
merged into this project.
10-
11-
## Table of contents
12-
* [Code of conduct](#code-of-conduct)
13-
* [Contribution ideas](#contribution-ideas)
14-
* [How to make changes to the project][4]
3+
I'm happy you're interested in contributing to this project. The open source community depends on people like you, and together we can make this project as good as it can possibly be. Thank you!
154

165
## Code of conduct
17-
The open source community should be open and welcoming for all. I have a zero
18-
tolerance policy against discrimination of race, ethnicity, religious
19-
affiliation, sexual orientation, gender identity, age, disability etc.
206

21-
I urge everyone to be respectful to each other and remember that behind that
22-
username is a human being. If someone makes a mistake or makes a "stupid"
23-
comment or question, please bear in mind that they may be a beginner, something
24-
everyone has once been.
7+
The open source community should be open and welcoming for all. I have a zero tolerance policy against discrimination of race, ethnicity, religious affiliation, sexual orientation, gender identity, age, disability etc.
8+
9+
I urge everyone to be respectful to each other and remember that behind that username is a human being. If someone makes a mistake or makes a "stupid" comment or question, please bear in mind that they may be a beginner, something everyone has once been.
2510

26-
Feel free to e-mail me at [oliver_twistor@hotmail.com][1] if you have any
27-
questions or complaints regarding this or anything else.
11+
Feel free to contact me through my [GitHub page][1] if you have any questions or complaints regarding this or anything else.
2812

2913
## Contribution ideas
30-
There are many ways in which you can contribute to this project. Some of them
31-
are listed in the following subsections.
3214

33-
### Start working on an open issue
34-
One very practical way in which you can contribute is to take a look at the
35-
[list of open and unassigned issues][3] to see if there is anything you want to
36-
help out with. For information on the necessary steps for that, please read the
37-
section *[How to make changes to the project][4]*.
15+
There are many ways in which you can contribute to this project. Some of them are listed here.
3816

3917
### Report bugs, propose new features or changes in existing features
40-
All software has bugs and I would very much appreciate help with identifying and
41-
reporting bugs, so they can be fixed. This is a good way to contribute even if
42-
you aren't a programmer.
4318

44-
When you have used this application for a while, you may come up with some
45-
ideas of cool new features, or annoyances in existing features which you would
46-
want to have changed. I very much appreciate new ideas on how to improve this
47-
application.
19+
All software has bugs, and I would very much appreciate help with identifying and reporting bugs, so they can be fixed. This is a good way to contribute even if you aren't a programmer yourself.
4820

4921
#### How to create a new issue
5022

5123
1. Go to the [new issue][2] page.
5224
1. Write a short and succinct *title*.
5325
1. Provide more details in the *comment* field if the title isn't enough.
54-
1. If you don't have repository access, skip to the next step.
55-
1. Select an *assignee* that should handle the issue. If you're not
56-
selecting yourself, you should probably leave this blank.
57-
1. Choose *labels*, for example *bug* for bugs and *enhancement* for new or
58-
changed features.
59-
1. Leave *Project* blank since that is best determined at a later date,
60-
unless you're sure that the issue really should be part of the upcoming
61-
release.
62-
1. Leave also *Milestone* blank for the same reason as for *Project*.
26+
1. Leave everything else as it is.
6327
1. Press the button *Submit new issue*.
6428

6529
## How to make changes to the project
66-
I've found an excellent article on how to fork a repository, work on an issue
67-
and then do a pull request to have your changes merged into the target
68-
repository.
6930

70-
https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/
31+
[GitHub help][3] is a very good resource on how to fork repositories, collaborate on issues and other things. If you need more help or want to discuss something else, please go to my [GitHub page][1] and contact me through there.
7132

7233

73-
[1]: mailto:oliver_twistor@hotmail.com
34+
[1]: https://github.com/olivertwistor
7435
[2]: https://github.com/olivertwistor/java-tui/issues/new
75-
[3]: https://github.com/olivertwistor/java-tui/issues
76-
[4]: #how-to-make-changes-to-the-project
36+
[3]: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Johan Nilsson
3+
Copyright (c) 2019-2022 Johan Nilsson
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 49 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,45 @@
11
# Java TUI
2-
This library provides the user with easier writing to and reading from the
3-
terminal.
42

5-
## Table of contents
6-
* [Who is this for?](#who-is-this-for)
7-
* [Prerequisites][1]
8-
* [Installation instructions](#installation-instructions)
9-
* [Usage](#usage)
10-
* [Licensing](#licensing)
11-
* [How to contribute](#how-to-contribute)
12-
* [Versioning](#versioning)
3+
Java is a verbose language. When you want to deal with user interfaces, there is a lot of boilerplate code you have to write. This library means to alleviate a lot of the boilerplate code necessary when you want to have a textual user interface.
134

14-
## Who is this for?
15-
This library may be useful for those who work with text-based user interfaces.
5+
## Installation
166

17-
## Prerequisites
18-
* [Java 7 or newer][2]
19-
20-
## Installation instructions
21-
This is a library, not a stand-alone application. Therefore it's intended to
22-
be included within other applications or libraries.
7+
This is a library, not a stand-alone application. Include this in your own applications or libraries.
238

249
To make use of this library, please do the following:
25-
1. Make sure you meet the [prerequisites][1].
26-
1. Go to the [releases page][4] and find the specific version you want. The
27-
lastest release is [0.1.0][5].
28-
1. Download `java-tui-x.x.x.jar` and place it in your own application's
29-
classpath.
10+
11+
1. Make sure you meet the prerequisites:
12+
* [Java 7 or later][2]
13+
1. Go to the [releases page][4] and find the specific version you want.
14+
1. Download `java-tui-x.x.x.jar` and place it in your own application's classpath.
3015
1. If you want Javadoc, download `java-tui-x.x.x-javadoc.jar`.
31-
* Please refer to your particular IDE on how to attach that to the previous
32-
JAR file you downloaded.
33-
* If you're not using an IDE, you can unpack the JAR file and browse the
34-
Javadoc in a web browser.
16+
* Please refer to your particular IDE on how to attach that to the previous JAR file you downloaded.
17+
* If you're not using an IDE, you can unpack the JAR file and browse the Javadoc in a web browser.
3518

36-
### Build from source
3719
To build this library from source, please do the following:
38-
1. Make sure you meet the [prerequisites][1].
39-
1. Go to the [releases page][4] and find the specific version you want. The
40-
lastest release is [0.1.0][5].
20+
21+
1. Make sure you meet the prerequisites:
22+
* [Java 7 or later][2]
23+
1. Go to the [releases page][4] and find the specific version you want.
4124
1. Download `java-tui-x.x.x-sources.jar` and unpack it.
42-
1. In that package, along with the source files you'll find the files
43-
`build.xml` and `build.properties`. With those, you can build the library
44-
(using [Apache ANT][6] or similar tools).
25+
1. In that package, along with the source files you'll find the files `build.xml` and `build.properties`. With those, you can build the library (using [Apache ANT][6] or similar tools).
4526

4627
## Usage
47-
In this library, there is one usable class:
48-
`nu.olivertwistor.java.tui.Terminal`. With this class, the user can write to
49-
and read from standard input and output.
5028

51-
Here are some examples:
29+
In this library, there are two classes: `Terminal` and `UnclosableInputStream`. With `Terminal`, you can write to standard output and read from standard input. An example:
5230

5331
```java
5432
import nu.olivertwistor.java.tui.Terminal;
5533

34+
@SuppressWarnings("ALL")
5635
class App
5736
{
5837
public static void main(final String[] args) throws Exception
5938
{
6039
Terminal.writeLine("Welcome to this app!");
6140
Terminal.write("This is the beginning of one line. ");
6241
Terminal.writeLine("This is continuing on that line.");
63-
42+
6443
final int age = Terminal.readInt("Please state your age: ");
6544
Terminal.write("Your age is ");
6645
Terminal.writeLine(age);
@@ -77,27 +56,42 @@ Please state your age: 36
7756
Your age is 36
7857
```
7958

80-
## Licensing
81-
This library is licensed under the MIT License. You'll find the full license
82-
terms in the file [LICENSE][3].
59+
The other class, `UnclosableInputStream` provides an InputStream that doesn't automatically close itself after use. An example:
60+
61+
```java
62+
import java.io.BufferedReader;
63+
import java.io.InputStreamReader;
64+
import java.nio.charset.StandardCharsets;
65+
66+
import nu.olivertwistor.java.tui.UnclosableInputStream;
8367

84-
## How to contribute
85-
Thank you for wanting to contribute to this project. Open source is all about
86-
community. Go and read the document [CONTRIBUTING.md][12] for more information
87-
on with what you can contribute and how to go about it.
68+
@SuppressWarnings("ALL")
69+
class App
70+
{
71+
public static void main(final String[] args) throws Exception
72+
{
73+
// Change the system input stream to prevent it closing.
74+
System.setIn(new UnclosableInputStream(System.in));
75+
76+
try (final BufferedReader br = new BufferedReader(
77+
new InputStreamReader(System.in, StandardCharsets.UTF_8)))
78+
{
79+
System.out.println(br.readLine());
80+
}
81+
finally
82+
{
83+
// Reset the system input stream.
84+
System.setIn(System.in);
85+
}
86+
}
87+
}
88+
```
8889

89-
## Versioning
90-
This project uses [Semantic Versioning 2.0.0][13] for version numbering. To see
91-
what's changed between versions, please read [CHANGELOG.md][14]. That file also
92-
has links to the download section of each release.
90+
## Licensing
91+
This library is licensed under an *MIT License*. You'll find the full license terms in the file [LICENSE][3].
9392

9493

95-
[1]: #prerequisites
9694
[2]: https://java.com/download/
9795
[3]: LICENSE
9896
[4]: https://github.com/olivertwistor/java-tui/releases
99-
[5]: https://github.com/olivertwistor/java-tui/releases/tag/v0.1.0
10097
[6]: https://ant.apache.org/
101-
[12]: CONTRIBUTING.md
102-
[13]: http://semver.org/
103-
[14]: CHANGELOG.md

build.properties

Lines changed: 0 additions & 16 deletions
This file was deleted.

build.xml

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)