Skip to content

Commit 707065f

Browse files
committed
Version Update with new features
1 parent 2591c55 commit 707065f

File tree

4 files changed

+193
-56
lines changed

4 files changed

+193
-56
lines changed

README.md

Lines changed: 91 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,114 @@
1+
To create a `README.md` file for your `fancy-progress-cli` project, I'll help refine the provided content into a polished, professional, and Markdown-formatted README. The content you shared is already well-structured, so I'll enhance it with clearer sections, improved formatting, and additional details commonly found in a README to make it more complete and user-friendly.
12

2-
# 🎉 fancy-progress-cli
3+
Below is the `README.md` content:
34

4-
A customizable, emoji-themed CLI progress bar tool for Node.js.
5+
```markdown
6+
# 🎉 Fancy Progress CLI
7+
8+
A customizable, emoji-themed CLI progress bar tool for Node.js. Add some flair to your terminal with visually engaging progress bars, perfect for scripts, automation tasks, or just for fun!
59

610
## 📦 Installation
711

12+
Install the package globally using npm:
13+
814
```bash
915
npm install -g fancy-progress-cli
10-
````
16+
```
1117

1218
## 🚀 Usage
1319

20+
Run the CLI with customizable options to display a progress bar with your preferred theme and settings:
21+
1422
```bash
1523
fancy-progress --total 50 --speed 80 --theme hearts --message "All done!"
1624
```
1725

26+
This command creates a progress bar with 50 steps, updates every 80ms, uses the `hearts` theme, and displays "All done!" when complete.
27+
1828
## 🔧 Options
1929

20-
| Flag | Alias | Description | Default |
21-
| ----------- | ----- | ---------------------------- | ------------- |
22-
| `--total` | `-t` | Total steps to complete | `50` |
23-
| `--speed` | `-s` | Milliseconds between steps | `100` |
24-
| `--theme` | `-m` | Theme for the progress bar | `classic` |
25-
| `--message` | | Final message after complete | `✅ Complete!` |
30+
Customize the progress bar using the following command-line flags:
31+
32+
| Flag | Alias | Description | Default |
33+
|-----------------|-------|------------------------------------------|--------------------|
34+
| `--total` | `-t` | Total number of steps in the progress bar | `50` |
35+
| `--speed` | `-s` | Interval between updates (milliseconds) | `100` |
36+
| `--theme` | `-m` | Theme for the progress bar (or `random`) | `classic` |
37+
| `--message` | `-msg`| Final message after completion | `✅ All done!` |
38+
| `--list-themes` | | List all available themes with previews | |
39+
40+
Use `--help` or `-h` to see the help menu:
41+
42+
```bash
43+
fancy-progress --help
44+
```
2645

2746
## 🎨 Themes
2847

29-
* `classic` → █ / ░
30-
* `stars` → ★ / ☆
31-
* `hearts` → ❤ / ♡
32-
* `dots` → ● / ○
33-
* `blocks` → ▓ / ▒
48+
Choose from a variety of themes to style your progress bar. Use the `--theme` flag to select one, or use `random` for a surprise!
49+
50+
| Theme | Complete / Incomplete |
51+
|------------|----------------------|
52+
| `classic` | █ / ░ |
53+
| `stars` | ★ / ☆ |
54+
| `hearts` | ❤ / ♡ |
55+
| `dots` | ● / ○ |
56+
| `blocks` | ▓ / ▒ |
57+
| `arrows` | ➤ / ➞ |
58+
| `flames` | 🔥 / · |
59+
| `bouncy` | ⣿ / ⣀ |
60+
| `emoji` | 🟩 / ⬜ |
61+
| `tech` | # / - |
62+
| `zen` | ✦ / ⋆ |
63+
| `sushi` | 🍣 / 🥢 |
64+
| `moon` | 🌕 / 🌑 |
65+
| `plants` | 🌱 / 🌿 |
3466

35-
## 💻 Example
67+
Preview all themes with:
3668

3769
```bash
38-
fancy-progress -t 40 -s 60 -m stars --message "✨ Finished!"
70+
fancy-progress --list-themes
71+
```
72+
73+
## 💻 Examples
74+
75+
1. Use the `stars` theme with a custom message:
76+
77+
```bash
78+
fancy-progress --total 40 --speed 60 --theme stars --message "✨ Finished!"
79+
```
80+
81+
2. Try a random theme with 30 steps:
82+
83+
```bash
84+
fancy-progress --total 30 --theme random --message "Surprise complete!"
85+
```
86+
87+
3. Fast progress with the `flames` theme:
88+
89+
```bash
90+
fancy-progress --total 30 --speed 50 --theme flames --message "🔥 Burn complete!"
91+
```
92+
93+
## 🛠️ Dependencies
94+
95+
- [cli-progress](https://www.npmjs.com/package/cli-progress): For rendering the progress bar.
96+
- [chalk](https://www.npmjs.com/package/chalk): For colorful terminal output.
97+
- [yargs](https://www.npmjs.com/package/yargs): For parsing command-line arguments.
98+
99+
## 📄 License
100+
101+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
102+
103+
## 🤝 Contributing
104+
105+
Contributions are welcome! Feel free to open issues or submit pull requests on the [GitHub repository](https://github.com/sameer52718/fancy-progress-cli).
106+
107+
## 📬 Contact
108+
109+
For questions or feedback, reach out via [GitHub Issues](https://github.com/sameer52718/fancy-progress-cli/issues).
110+
111+
---
112+
113+
Happy progressing! 🚀
39114
```

cli.js

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,82 @@ const chalk = require("chalk");
55
const yargs = require("yargs");
66
const themes = require("./themes");
77

8+
const themeKeys = Object.keys(themes);
9+
10+
// Parse CLI arguments
811
const argv = yargs
912
.option("total", {
1013
alias: "t",
1114
type: "number",
1215
default: 50,
13-
describe: "Total number of steps",
16+
describe: "Total number of steps in the progress bar",
1417
})
1518
.option("speed", {
1619
alias: "s",
1720
type: "number",
1821
default: 100,
19-
describe: "Interval speed in ms",
22+
describe: "Interval speed in milliseconds",
2023
})
2124
.option("theme", {
2225
alias: "m",
23-
choices: Object.keys(themes),
26+
type: "string",
2427
default: "classic",
25-
describe: "Progress bar theme",
28+
describe: "Theme name or 'random' for a surprise",
29+
choices: [...themeKeys, "random"],
2630
})
2731
.option("message", {
2832
alias: "msg",
2933
type: "string",
30-
describe: "Completion message",
34+
describe: "Final message after progress completes",
35+
})
36+
.option("list-themes", {
37+
type: "boolean",
38+
describe: "List all available themes with preview",
3139
})
32-
.help().argv;
40+
.help()
41+
.alias("help", "h").argv;
3342

34-
const theme = themes[argv.theme];
43+
// Handle --list-themes command
44+
if (argv["list-themes"]) {
45+
console.log(chalk.bold("\n🎨 Available Themes:\n"));
46+
themeKeys.forEach((key) => {
47+
const t = themes[key];
48+
console.log(
49+
`${key.padEnd(10)}${chalk.green(t.complete.repeat(3))}${chalk.gray(" ")}${chalk.white(t.incomplete.repeat(3))}`
50+
);
51+
});
52+
console.log();
53+
process.exit(0);
54+
}
3555

56+
// Select theme
57+
const selectedTheme =
58+
argv.theme === "random"
59+
? themes[themeKeys[Math.floor(Math.random() * themeKeys.length)]]
60+
: themes[argv.theme] || themes.classic;
61+
62+
// Create and start the progress bar
3663
const bar = new cliProgress.SingleBar({
37-
format: `{bar} | ${chalk.cyan("{percentage}%")} | ${chalk.green("{value}/{total}")}`,
38-
barCompleteChar: theme.complete,
39-
barIncompleteChar: theme.incomplete,
64+
format: `${chalk.magenta("{bar}")} | ${chalk.cyan("{percentage}%")} | ${chalk.green("{value}/{total}")}`,
65+
barCompleteChar: selectedTheme.complete,
66+
barIncompleteChar: selectedTheme.incomplete,
4067
hideCursor: true,
4168
});
4269

4370
const total = argv.total;
71+
let value = 0;
72+
4473
bar.start(total, 0);
4574

46-
let value = 0;
4775
const interval = setInterval(() => {
4876
value++;
4977
bar.update(value);
78+
5079
if (value >= total) {
51-
bar.stop();
5280
clearInterval(interval);
53-
if (argv.message) {
54-
console.log(chalk.green(`🎉 ${argv.message}`));
55-
} else {
56-
console.log(chalk.cyan("✅ All done!"));
57-
}
81+
bar.stop();
82+
console.log(
83+
chalk.green(`\n${argv.message ? `🎉 ${argv.message}` : "✅ All done!"}`)
84+
);
5885
}
5986
}, argv.speed);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fancy-progress-cli",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "A customizable emoji-themed CLI progress bar tool",
55
"main": "cli.js",
66
"bin": {

themes.js

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
11
module.exports = {
2-
classic: {
3-
complete: '█',
4-
incomplete: '░'
5-
},
6-
stars: {
7-
complete: '★',
8-
incomplete: '☆'
9-
},
10-
hearts: {
11-
complete: '❤',
12-
incomplete: '♡'
13-
},
14-
dots: {
15-
complete: '●',
16-
incomplete: '○'
17-
},
18-
blocks: {
19-
complete: '▓',
20-
incomplete: '▒'
21-
}
22-
};
23-
2+
classic: {
3+
complete: '█',
4+
incomplete: '░'
5+
},
6+
stars: {
7+
complete: '★',
8+
incomplete: '☆'
9+
},
10+
hearts: {
11+
complete: '❤',
12+
incomplete: '♡'
13+
},
14+
dots: {
15+
complete: '●',
16+
incomplete: '○'
17+
},
18+
blocks: {
19+
complete: '▓',
20+
incomplete: '▒'
21+
},
22+
arrows: {
23+
complete: '➤',
24+
incomplete: '➞'
25+
},
26+
flames: {
27+
complete: '🔥',
28+
incomplete: '·'
29+
},
30+
bouncy: {
31+
complete: '⣿',
32+
incomplete: '⣀'
33+
},
34+
emoji: {
35+
complete: '🟩',
36+
incomplete: '⬜'
37+
},
38+
tech: {
39+
complete: '#',
40+
incomplete: '-'
41+
},
42+
zen: {
43+
complete: '✦',
44+
incomplete: '⋆'
45+
},
46+
sushi: {
47+
complete: '🍣',
48+
incomplete: '🥢'
49+
},
50+
moon: {
51+
complete: '🌕',
52+
incomplete: '🌑'
53+
},
54+
plants: {
55+
complete: '🌱',
56+
incomplete: '🌿'
57+
}
58+
};

0 commit comments

Comments
 (0)