Skip to content

Commit e1ee531

Browse files
committed
copy base64 to the clipboard
1 parent d4c8e97 commit e1ee531

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ zx is a set of handy commands to make some daily tasks easier.
5858
version: v0.3.0
5959
```
6060

61+
### base64
62+
63+
_Copies automatically the output to the clipboard._
64+
65+
Encode
66+
```
67+
~ zx base64 -e "zx is a set of handy commands to make some daily tasks easier"
68+
enggaXMgYSBzZXQgb2YgaGFuZHkgY29tbWFuZHMgdG8gbWFrZSBzb21lIGRhaWx5IHRhc2tzIGVhc2llcg==
69+
```
70+
71+
Decode
72+
```
73+
~ zx base64 enggaXMgYSBzZXQgb2YgaGFuZHkgY29tbWFuZHMgdG8gbWFrZSBzb21lIGRhaWx5IHRhc2tzIGVhc2llcg==
74+
zx is a set of handy commands to make some daily tasks easier
75+
```
76+
6177
### cpf
6278

6379
_Copies automatically the output to the clipboard._

cmd/base64.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/base64"
55
"fmt"
66

7+
"github.com/martinusso/zx/internal/clipboard"
78
"github.com/spf13/cobra"
89
)
910

@@ -18,7 +19,9 @@ var (
1819
zx base64 -e zx
1920
zx base64 -d eng=`,
2021
Run: func(cmd *cobra.Command, args []string) {
21-
fmt.Println(processBase64(args))
22+
s := processBase64(args)
23+
clipboard.Write(s)
24+
fmt.Println(s)
2225
},
2326
}
2427
)

0 commit comments

Comments
 (0)