Skip to content

Commit e51737f

Browse files
authored
Revise README with new features and version update
Updated README to reflect version change and added new features.
1 parent 491e510 commit e51737f

1 file changed

Lines changed: 78 additions & 7 deletions

File tree

README.md

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ A lightweight Java teaching library for rapid, structured student projects
1010
## Features
1111

1212
- GitHub API helpers for reading remote repository contents
13-
- Simple integration with Maven
13+
- URL parsing utilities for GitHub paths
14+
- Optional GitHub token support via `tulip.properties`
15+
- Simple integration with Maven
1416

1517
## Installation
1618

17-
You can include **TULIP** in your Java project using JitPack
19+
Include **TULIP** in your Java project using JitPack.
1820

19-
1. With Maven, add the JitPack repository:
21+
### 1. Add the JitPack repository
2022

2123
```xml
2224
<repositories>
@@ -27,16 +29,85 @@ You can include **TULIP** in your Java project using JitPack
2729
</repositories>
2830
```
2931

30-
2. Add the dependency:
32+
### 2. Add the dependency
3133

3234
```xml
3335
<dependency>
3436
<groupId>com.github.javiergs</groupId>
3537
<artifactId>TULIP</artifactId>
36-
<version>v2.5</version>
38+
<version>v3.0</version>
3739
</dependency>
3840
```
3941

40-
## Documentation
42+
## What TULIP Provides
4143

42-
[View JavaDoc](https://javiergs.github.io/TULIP/)
44+
### URL Parsing Utilities
45+
46+
- **URLFactory**
47+
Parses GitHub URLs (root, tree, blob) and normalizes missing parts (e.g., default branch = `main`)
48+
49+
- **URLObject**
50+
Represents a structured GitHub resource with:
51+
- owner
52+
- repository
53+
- revision (branch/tag/commit)
54+
- path
55+
- kind (`ROOT`, `TREE`, `BLOB`)
56+
- convenience helpers `isBlob()`, `isDirectory()`
57+
58+
### GitHub API Tools
59+
60+
**GitHubHandler**
61+
- List files and folders in any repo
62+
- Fetch file contents
63+
- Recursive traversal of remote repositories
64+
- Automatic fallback to `main` branch
65+
- Supports authentication via a *local properties file*
66+
67+
## Using a GitHub Token (optional but recommended)
68+
69+
Create a file:
70+
71+
```
72+
src/main/resources/tulip.properties
73+
```
74+
75+
Add:
76+
77+
```
78+
GITHUB_TOKEN=ghp_your_token_here
79+
```
80+
81+
This avoids API rate limits for unauthenticated users.
82+
83+
## Basic Usage Examples
84+
85+
### Parse a GitHub URL
86+
87+
```java
88+
URLObject u = URLFactory.parseGitHubUrl(
89+
"https://github.com/javiergs/ADASIM/tree/main/src"
90+
);
91+
```
92+
93+
### List files in a repository
94+
95+
```java
96+
GitHubHandler gh = new GitHubHandler();
97+
List<String> files = gh.listFiles("https://github.com/javiergs/ADASIM");
98+
```
99+
100+
### Fetch contents of a remote file
101+
102+
```java
103+
String text = gh.getFileContentFromUrl(
104+
"https://github.com/javiergs/ADASIM/blob/main/pom.xml"
105+
);
106+
```
107+
108+
---
109+
110+
## API Reference
111+
Full JavaDoc available at:
112+
113+
➡️ https://javiergs.github.io/TULIP/

0 commit comments

Comments
 (0)