Skip to content

Commit 0101875

Browse files
committed
docs: Updated Documentation
1 parent dd61a04 commit 0101875

File tree

9 files changed

+65
-66
lines changed

9 files changed

+65
-66
lines changed

README.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Class library that can help in writing command line based applications with mini
33

44
<p align="center">
55
<a target="_blank" href="https://github.com/WebFiori/cli/actions/workflows/php84.yaml">
6-
<img src="https://github.com/WebFiori/cli/actions/workflows/php83.yaml/badge.svg?branch=main">
6+
<img src="https://github.com/WebFiori/cli/actions/workflows/php84.yaml/badge.svg?branch=main">
77
</a>
88
<a href="https://codecov.io/gh/WebFiori/cli">
99
<img src="https://codecov.io/gh/WebFiori/cli/branch/main/graph/badge.svg" />
@@ -104,13 +104,13 @@ exit(\$runner->start());
104104
A complete sample application with multiple examples can be found here: **[📁 View Sample Application](https://github.com/WebFiori/cli/tree/main/examples)**
105105

106106
The sample application includes:
107-
- **[Basic Commands](https://github.com/WebFiori/cli/tree/main/examples/01-basic-command)** - Simple command creation
108-
- **[Arguments Handling](https://github.com/WebFiori/cli/tree/main/examples/02-command-with-args)** - Working with command arguments
109-
- **[Interactive Mode](https://github.com/WebFiori/cli/tree/main/examples/03-interactive-mode)** - Building interactive applications
107+
- **[Basic Commands](https://github.com/WebFiori/cli/tree/main/examples/01-basic-hello-world)** - Simple command creation
108+
- **[Arguments Handling](https://github.com/WebFiori/cli/tree/main/examples/02-arguments-and-options)** - Working with command arguments
109+
- **[User Input](https://github.com/WebFiori/cli/tree/main/examples/03-user-input)** - Building interactive applications
110110
- **[Multi-Command Apps](https://github.com/WebFiori/cli/tree/main/examples/10-multi-command-app)** - Complex applications with multiple commands
111-
- **[Progress Bars](https://github.com/WebFiori/cli/tree/main/examples/05-progress-bars)** - Visual progress indicators
111+
- **[Progress Bars](https://github.com/WebFiori/cli/tree/main/examples/07-progress-bars)** - Visual progress indicators
112112
- **[Table Display](https://github.com/WebFiori/cli/tree/main/examples/06-table-display)** - Formatting data in tables
113-
- **[Testing Examples](https://github.com/WebFiori/cli/tree/main/examples/tests)** - Unit testing your commands
113+
- **[Database Operations](https://github.com/WebFiori/cli/tree/main/examples/09-database-ops)** - Database CLI commands
114114

115115
## Installation
116116

@@ -165,7 +165,7 @@ php app.php greet
165165
# Output: Hello from WebFiori CLI!
166166
```
167167

168-
**[📖 View Complete Example](https://github.com/WebFiori/cli/tree/main/examples/01-basic-command)**
168+
**[📖 View Complete Example](https://github.com/WebFiori/cli/tree/main/examples/01-basic-hello-world)**
169169

170170
### Command with Arguments
171171

@@ -210,7 +210,7 @@ php app.php greet-person --name=Sarah
210210
# Output: Hello Friend Sarah!
211211
```
212212

213-
**[📖 View Complete Example](https://github.com/WebFiori/cli/tree/main/examples/02-command-with-args)**
213+
**[📖 View Complete Example](https://github.com/WebFiori/cli/tree/main/examples/02-arguments-and-options)**
214214

215215
### Multi-Command Application
216216

@@ -394,7 +394,7 @@ This will show following output in terminal:
394394
>>
395395
```
396396

397-
**[📖 View Interactive Mode Example](https://github.com/WebFiori/cli/tree/main/examples/03-interactive-mode)**
397+
**[📖 View Interactive Mode Example](https://github.com/WebFiori/cli/tree/main/examples/05-interactive-commands)**
398398

399399
### Input and Output Streams
400400

@@ -411,7 +411,7 @@ $command->setInputStream(new FileInputStream('input.txt'));
411411
$command->setOutputStream(new FileOutputStream('output.txt'));
412412
```
413413

414-
**[📖 View Streams Example](https://github.com/WebFiori/cli/tree/main/examples/04-custom-streams)**
414+
**[📖 View Streams Example](https://github.com/WebFiori/cli/tree/main/examples/08-file-processing)**
415415

416416
### ANSI Colors and Formatting
417417

@@ -427,7 +427,7 @@ public function exec(): int {
427427
}
428428
```
429429

430-
**[📖 View Formatting Example](https://github.com/WebFiori/cli/tree/main/examples/07-ansi-formatting)**
430+
**[📖 View Formatting Example](https://github.com/WebFiori/cli/tree/main/examples/04-output-formatting)**
431431

432432
### Progress Bars
433433

@@ -449,7 +449,7 @@ public function exec(): int {
449449
}
450450
```
451451

452-
**[📖 View Progress Bar Example](https://github.com/WebFiori/cli/tree/main/examples/05-progress-bars)**
452+
**[📖 View Progress Bar Example](https://github.com/WebFiori/cli/tree/main/examples/07-progress-bars)**
453453

454454
### Table Display
455455

@@ -458,8 +458,8 @@ Display data in formatted tables:
458458
```php
459459
public function exec(): int {
460460
$data = [
461-
['John Doe', 30, 'New York'],
462-
['Jane Smith', 25, 'Los Angeles']
461+
['Ahmed Hassan', 30, 'Cairo'],
462+
['Sarah Johnson', 25, 'Los Angeles']
463463
];
464464
$headers = ['Name', 'Age', 'City'];
465465

@@ -593,34 +593,33 @@ class HelloCommandTest extends CommandTestCase {
593593

594594
```
595595

596-
**[📖 View Testing Examples](https://github.com/WebFiori/cli/tree/main/examples/tests)**
596+
**[📖 View Testing Examples](https://github.com/WebFiori/cli/tree/main/examples/10-multi-command-app)**
597597

598598
## Examples
599599

600600
Explore comprehensive examples to learn different aspects of WebFiori CLI:
601601

602602
### Basic Examples
603-
- **[📁 Basic Command](https://github.com/WebFiori/cli/tree/main/examples/01-basic-command)** - Create your first CLI command
604-
- **[📁 Command with Arguments](https://github.com/WebFiori/cli/tree/main/examples/02-command-with-args)** - Handle command-line arguments
605-
- **[📁 Interactive Mode](https://github.com/WebFiori/cli/tree/main/examples/03-interactive-mode)** - Build interactive CLI applications
603+
- **[📁 Basic Command](https://github.com/WebFiori/cli/tree/main/examples/01-basic-hello-world)** - Create your first CLI command
604+
- **[📁 Command with Arguments](https://github.com/WebFiori/cli/tree/main/examples/02-arguments-and-options)** - Handle command-line arguments
605+
- **[📁 User Input](https://github.com/WebFiori/cli/tree/main/examples/03-user-input)** - Read and validate user input
606+
- **[📁 Output Formatting](https://github.com/WebFiori/cli/tree/main/examples/04-output-formatting)** - Colors and text formatting
606607

607608
### Advanced Examples
608-
- **[📁 Custom Streams](https://github.com/WebFiori/cli/tree/main/examples/04-custom-streams)** - Custom input/output handling
609-
- **[📁 Progress Bars](https://github.com/WebFiori/cli/tree/main/examples/05-progress-bars)** - Visual progress indicators
609+
- **[📁 Interactive Commands](https://github.com/WebFiori/cli/tree/main/examples/05-interactive-commands)** - Build interactive CLI applications
610610
- **[📁 Table Display](https://github.com/WebFiori/cli/tree/main/examples/06-table-display)** - Format data in tables
611-
- **[📁 ANSI Formatting](https://github.com/WebFiori/cli/tree/main/examples/07-ansi-formatting)** - Colors and text formatting
611+
- **[📁 Progress Bars](https://github.com/WebFiori/cli/tree/main/examples/07-progress-bars)** - Visual progress indicators
612612
- **[📁 File Processing](https://github.com/WebFiori/cli/tree/main/examples/08-file-processing)** - File manipulation commands
613613
- **[📁 Database Operations](https://github.com/WebFiori/cli/tree/main/examples/09-database-ops)** - Database CLI commands
614614

615615
### Complete Applications
616616
- **[📁 Multi-Command Application](https://github.com/WebFiori/cli/tree/main/examples/10-multi-command-app)** - Full-featured CLI application
617-
- **[📁 Testing Suite](https://github.com/WebFiori/cli/tree/main/examples/tests)** - Unit testing examples
618617

619618
### Quick Links
620619
- **[📖 All Examples](https://github.com/WebFiori/cli/tree/main/examples)** - Browse all available examples
621-
- **[🧪 Test Examples](https://github.com/WebFiori/cli/tree/main/examples/tests/HelloCommandTest.php)** - See how to test your commands
622-
- **[🚀 Sample App](https://github.com/WebFiori/cli/tree/main/examples/10-multi-command-app/app.php)** - Ready-to-run sample application
620+
- **[🚀 Sample App](https://github.com/WebFiori/cli/tree/main/examples/10-multi-command-app/main.php)** - Ready-to-run sample application
621+
623622

624623
---
625624

626-
**Ready to build amazing CLI applications? Start with the [📁 Basic Command Example](https://github.com/WebFiori/cli/tree/main/examples/01-basic-command) and work your way up!**
625+
**Ready to build amazing CLI applications? Start with the [📁 Basic Command Example](https://github.com/WebFiori/cli/tree/main/examples/01-basic-hello-world) and work your way up!**

examples/03-user-input/SimpleCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function exec(): int {
1414

1515
// Simulate collecting data
1616
$data = [
17-
'name' => 'John Doe',
17+
'name' => 'Ahmed Hassan',
1818
'email' => 'john@example.com',
1919
'age' => 30,
2020
'country' => 'Canada',

examples/04-output-formatting/FormattingDemoCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ private function createLists(): void {
216216
private function createSimpleTable(): void {
217217
$headers = ['Name', 'Age', 'City'];
218218
$rows = [
219-
['John Doe', '30', 'New York'],
220-
['Jane Smith', '25', 'Los Angeles'],
221-
['Bob Johnson', '35', 'Chicago']
219+
['Ahmed Hassan', '30', 'Cairo'],
220+
['Sarah Johnson', '25', 'Los Angeles'],
221+
['Omar Al-Rashid', '35', 'Dubai']
222222
];
223223

224224
// Header
@@ -263,7 +263,7 @@ private function createStyledTable(): void {
263263
$this->println();
264264

265265
$data = [
266-
['Alice Brown', '28', 'Engineering'],
266+
['Fatima Al-Zahra', '28', 'Engineering'],
267267
['Charlie Davis', '32', 'Marketing'],
268268
['Diana Wilson', '29', 'Design']
269269
];

examples/06-table-display/TableDemoCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ private function demoDataExport(string $style, string $theme, int $width): void
177177
$this->println('---------------------------');
178178

179179
$exportData = [
180-
['1', 'John Doe', 'john@example.com', 'Active'],
181-
['2', 'Jane Smith', 'jane@example.com', 'Inactive'],
182-
['3', 'Bob Johnson', 'bob@example.com', 'Active']
180+
['1', 'Ahmed Hassan', 'ahmed.hassan@example.com', 'Active'],
181+
['2', 'Sarah Johnson', 'sarah.johnson@example.com', 'Inactive'],
182+
['3', 'Omar Al-Rashid', 'omar.alrashid@example.com', 'Active']
183183
];
184184

185185
$table = TableBuilder::create()
@@ -372,11 +372,11 @@ private function demoUserManagement(string $style, string $theme, int $width): v
372372
$this->println('-------------------------');
373373

374374
$users = [
375-
['1', 'John Doe', 'john.doe@example.com', 'Active', '2024-01-15', 'Admin', '$1,250.75'],
376-
['2', 'Jane Smith', 'jane.smith@example.com', 'Inactive', '2024-01-16', 'User', '$890.50'],
377-
['3', 'Bob Johnson', 'bob.johnson@example.com', 'Active', '2024-01-17', 'Manager', '$2,100.00'],
378-
['4', 'Alice Brown', 'alice.brown@example.com', 'Pending', '2024-01-18', 'User', '$750.25'],
379-
['5', 'Charlie Davis', 'charlie.davis@example.com', 'Active', '2024-01-19', 'Admin', '$1,800.80']
375+
['1', 'Ahmed Hassan', 'ahmed.hassan@example.com', 'Active', '2024-01-15', 'Admin', '$1,250.75'],
376+
['2', 'Sarah Johnson', 'sarah.johnson@example.com', 'Inactive', '2024-01-16', 'User', '$890.50'],
377+
['3', 'Omar Al-Rashid', 'omar.alrashid@example.com', 'Active', '2024-01-17', 'Manager', '$2,100.00'],
378+
['4', 'Fatima Al-Zahra', 'fatima.alzahra@example.com', 'Pending', '2024-01-18', 'User', '$750.25'],
379+
['5', 'Michael Davis', 'michael.davis@example.com', 'Active', '2024-01-19', 'Admin', '$1,800.80']
380380
];
381381

382382
$table = TableBuilder::create()

examples/06-table-display/simple-example.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
$basicTable = TableBuilder::create()
2929
->setHeaders(['Name', 'Age', 'City'])
30-
->addRow(['John Doe', 30, 'New York'])
31-
->addRow(['Jane Smith', 25, 'Los Angeles'])
32-
->addRow(['Bob Johnson', 35, 'Chicago']);
30+
->addRow(['Ahmed Hassan', 30, 'Cairo'])
31+
->addRow(['Sarah Johnson', 25, 'Los Angeles'])
32+
->addRow(['Omar Al-Rashid', 35, 'Dubai']);
3333

3434
echo $basicTable->render()."\n\n";
3535

examples/09-database-ops/main.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ private function seedDatabase(): int {
135135

136136
// Insert sample users
137137
$users = [
138-
['John Doe', 'john@example.com'],
139-
['Jane Smith', 'jane@example.com'],
140-
['Bob Johnson', 'bob@example.com']
138+
['Ahmed Hassan', 'ahmed.hassan@example.com'],
139+
['Sarah Johnson', 'sarah.johnson@example.com'],
140+
['Omar Al-Rashid', 'omar.alrashid@example.com']
141141
];
142142

143143
foreach ($users as $user) {
@@ -150,9 +150,9 @@ private function seedDatabase(): int {
150150
// Insert sample posts
151151
$posts = [
152152
[1, 'First Post', 'This is the content of the first post.'],
153-
[1, 'Second Post', 'This is another post by John.'],
154-
[2, 'Jane\'s Post', 'Hello from Jane!'],
155-
[3, 'Bob\'s Thoughts', 'Some thoughts from Bob.']
153+
[1, 'Second Post', 'This is another post by Ahmed.'],
154+
[2, 'Sarah\'s Post', 'Hello from Sarah!'],
155+
[3, 'Omar\'s Thoughts', 'Some thoughts from Omar.']
156156
];
157157

158158
foreach ($posts as $post) {

examples/09-database-ops/seeds/users.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
[
22
{
3-
"name": "John Doe",
4-
"email": "john.doe@example.com",
3+
"name": "Ahmed Hassan",
4+
"email": "ahmed.hassan@example.com",
55
"password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
66
"status": "active"
77
},
88
{
9-
"name": "Jane Smith",
10-
"email": "jane.smith@example.com",
9+
"name": "Sarah Johnson",
10+
"email": "sarah.johnson@example.com",
1111
"password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
1212
"status": "active"
1313
},
1414
{
15-
"name": "Bob Johnson",
16-
"email": "bob.johnson@example.com",
15+
"name": "Omar Al-Rashid",
16+
"email": "omar.alrashid@example.com",
1717
"password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
1818
"status": "inactive"
1919
},
2020
{
21-
"name": "Alice Brown",
22-
"email": "alice.brown@example.com",
21+
"name": "Fatima Al-Zahra",
22+
"email": "fatima.alzahra@example.com",
2323
"password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
2424
"status": "active"
2525
},
2626
{
27-
"name": "Charlie Wilson",
28-
"email": "charlie.wilson@example.com",
27+
"name": "Michael Davis",
28+
"email": "michael.davis@example.com",
2929
"password": "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
3030
"status": "active"
3131
}

examples/10-multi-command-app/commands/UserCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ private function showUsage(): int {
497497
$this->println();
498498
$this->println('Examples:');
499499
$this->println(' php main.php user --action=list');
500-
$this->println(' php main.php user --action=create --name="John Doe" --email="john@example.com"');
501-
$this->println(' php main.php user --action=update --id=1 --name="Jane Doe"');
500+
$this->println(' php main.php user --action=create --name="Ahmed Hassan" --email="ahmed.hassan@example.com"');
501+
$this->println(' php main.php user --action=update --id=1 --name="Sarah Johnson"');
502502
$this->println(' php main.php user --action=delete --id=1');
503-
$this->println(' php main.php user --action=search --search="john"');
503+
$this->println(' php main.php user --action=search --search="ahmed"');
504504
$this->println(' php main.php user --action=export --format=json');
505505

506506
return 0;

examples/10-multi-command-app/data/users.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[
22
{
33
"id": 1,
4-
"name": "John Doe",
5-
"email": "john.doe@example.com",
4+
"name": "Ahmed Hassan",
5+
"email": "ahmed.hassan@example.com",
66
"status": "active",
77
"created_at": "2024-01-15 10:30:00",
88
"updated_at": "2024-01-15 10:30:00"
99
},
1010
{
1111
"id": 2,
12-
"name": "Jane Smith",
13-
"email": "jane.smith@example.com",
12+
"name": "Sarah Johnson",
13+
"email": "sarah.johnson@example.com",
1414
"status": "active",
1515
"created_at": "2024-01-16 14:20:00",
1616
"updated_at": "2024-01-16 14:20:00"
1717
},
1818
{
1919
"id": 3,
20-
"name": "Bob Johnson",
21-
"email": "bob.johnson@example.com",
20+
"name": "Omar Al-Rashid",
21+
"email": "omar.alrashid@example.com",
2222
"status": "inactive",
2323
"created_at": "2024-01-17 09:15:00",
2424
"updated_at": "2024-01-17 09:15:00"

0 commit comments

Comments
 (0)