-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 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 |
---|---|---|
|
@@ -10,4 +10,73 @@ | |
|
||
- Lightweight, no dependencies (jar package only `13kb`) | ||
- API is easy to use | ||
- Easy to integrate or customize modifications, only one `Java` file, and code specification | ||
- Easy to integrate or customize modifications, only one `Java` file, and code specification | ||
|
||
## How to use | ||
|
||
### Maven | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.blinkfox</groupId> | ||
<artifactId>mini-table</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</dependency> | ||
``` | ||
|
||
> **Note**: The current version is still `SNAPSHOT`, which can be used directly by the `copy` Java file. | ||
### API | ||
|
||
#### Demo1 (No Title) | ||
|
||
```java | ||
String table = new MiniTable() | ||
.addHeaders("header1", "header2") | ||
.addDatas("col11", "col12") | ||
.addDatas("col21", "col22") | ||
.render(); | ||
System.out.println(table); | ||
``` | ||
|
||
Output Result: | ||
|
||
```bash | ||
+---------+---------+ | ||
| header1 | header2 | | ||
+---------+---------+ | ||
| col11 | col12 | | ||
| col21 | col22 | | ||
+---------+---------+ | ||
``` | ||
|
||
#### Demo2(Titled) | ||
|
||
```java | ||
String table = new MiniTable("The Title") | ||
.addHeaders("Name", "Sex", "Age", "Email", "Phone") | ||
.addDatas("LiLei", "male", 25, "[email protected]", "13809345219") | ||
.addDatas("hanMeiMei", "female", 23, "[email protected]", "13515343853") | ||
.addDatas("ZhangSan", "female", 32, "[email protected]", "13920199836") | ||
.render(); | ||
System.out.println(table); | ||
``` | ||
|
||
Output Result: | ||
|
||
```bash | ||
+-------------------------------------------------------------+ | ||
| The Title | | ||
+-----------+--------+-----+--------------------+-------------+ | ||
| Name | Sex | Age | Email | Phone | | ||
+-----------+--------+-----+--------------------+-------------+ | ||
| LiLei | male | 25 | [email protected] | 13809345219 | | ||
| hanMeiMei | female | 23 | [email protected] | 13515343853 | | ||
| ZhangSan | female | 32 | [email protected] | 13920199836 | | ||
+-----------+--------+-----+--------------------+-------------+ | ||
``` | ||
|
||
## License | ||
|
||
本 类库遵守 [Apache License 2.0][http://www.apache.org/licenses/LICENSE-2.0] 许可证. | ||
This [mini-table](https://github.com/blinkfox/mini-table) library is open sourced under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). |
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