File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,20 @@ Install 📡
29
29
----------
30
30
31
31
``` console
32
- go get github.com/edoardottt/go-readingtime
32
+ go install github.com/edoardottt/go-readingtime/cmd/readt@latest
33
33
```
34
34
35
35
Usage 💡
36
36
----------
37
37
38
+ CLI tool
39
+
40
+ ``` console
41
+ readt <filepath>
42
+ ```
43
+
44
+ Golang module
45
+
38
46
``` go
39
47
package main
40
48
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "log"
6
+ "os"
7
+
8
+ reading "github.com/edoardottt/go-readingtime"
9
+ )
10
+
11
+ const (
12
+ argsNumber = 2
13
+ )
14
+
15
+ func main () {
16
+ if len (os .Args ) != argsNumber {
17
+ log .Fatal ("Usage: readt filepath" )
18
+ }
19
+
20
+ file , err := os .ReadFile (os .Args [1 ])
21
+ if err != nil {
22
+ log .Fatal (err )
23
+ }
24
+
25
+ t := reading .HumanEstimate (string (file ))
26
+
27
+ fmt .Printf ("It would take about %s.\n " , t )
28
+ }
You can’t perform that action at this time.
0 commit comments