aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-04-27 23:23:25 +0900
committernsfisis <nsfisis@gmail.com>2025-04-27 23:24:17 +0900
commit531820f3d60a301751c41d0aac5bbf5615f677b1 (patch)
treed178e7878ca2d8049388182e2fbabf1c273fa364
parentf42703288ce166381febfe8bcdc01c412f414772 (diff)
downloadterm-clock-531820f3d60a301751c41d0aac5bbf5615f677b1.tar.gz
term-clock-531820f3d60a301751c41d0aac5bbf5615f677b1.tar.zst
term-clock-531820f3d60a301751c41d0aac5bbf5615f677b1.zip
feat: run "clock" subcommand if no subcommand is givenv1.0.0
-rw-r--r--README.md18
-rw-r--r--cmd/clock.go2
-rw-r--r--cmd/root.go4
3 files changed, 17 insertions, 7 deletions
diff --git a/README.md b/README.md
index 963bcd0..3a2b891 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ A digital clock that runs in your terminal, providing clock, alarm and timer.
## Installation
```bash
-go install github.com/nsfisis/term-clock@latest
+$ go install github.com/nsfisis/term-clock@latest
```
## Usage
@@ -21,7 +21,13 @@ go install github.com/nsfisis/term-clock@latest
Displays the current time in digital format.
```bash
-term-clock clock
+$ term-clock clock
+```
+
+or
+
+```bash
+$ term-clock
```
### Alarm Mode
@@ -29,7 +35,7 @@ term-clock clock
The screen flashes when the specified time is reached. Time should be specified in 24-hour format (HH:MM).
```bash
-term-clock alarm 07:00 # Alarm at 7:00 AM
+$ term-clock alarm 07:00 # Alarm at 7:00 AM
```
### Timer Mode
@@ -38,9 +44,9 @@ Counts down from the specified duration. Time should be specified using Go's dur
The screen flashes when the timer ends.
```bash
-term-clock timer 25m # 25-minute timer
-term-clock timer 90s # 90-second timer
-term-clock timer 1h30m # 1 hour 30 minutes timer (note: maximum 99 minutes)
+$ term-clock timer 25m # 25-minute timer
+$ term-clock timer 90s # 90-second timer
+$ term-clock timer 1h30m # 1 hour 30 minutes timer (note: maximum 99 minutes)
```
## How to Exit
diff --git a/cmd/clock.go b/cmd/clock.go
index 71f01c7..485d6bd 100644
--- a/cmd/clock.go
+++ b/cmd/clock.go
@@ -65,6 +65,6 @@ func cmdClock(cmd *cobra.Command, args []string) {
var clockCmd = &cobra.Command{
Use: "clock",
- Short: "Clock mode",
+ Short: "Clock mode (default)",
Run: cmdClock,
}
diff --git a/cmd/root.go b/cmd/root.go
index 3efadab..5a91eae 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -7,6 +7,10 @@ import (
var rootCmd = &cobra.Command{
Use: "term-clock",
Short: "A clock on your terminal",
+ // Run 'clock' subcommand by default.
+ Run: func(cmd *cobra.Command, args []string) {
+ clockCmd.Run(cmd, args)
+ },
}
func init() {