Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit c8a50ff

Browse files
committed
new feature: start building secman files command with send subcmd
1 parent 64f1752 commit c8a50ff

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

app/files.go

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package app
2+
3+
import (
4+
"log"
5+
6+
"github.com/spf13/cobra"
7+
"github.com/abdfnx/tran/tools"
8+
"github.com/scmn-dev/tran/models"
9+
"github.com/scmn-dev/tran/constants"
10+
senderUI "github.com/scmn-dev/tran/tui"
11+
)
12+
13+
func FilesCMD() *cobra.Command {
14+
cmd := &cobra.Command{
15+
Use: "files",
16+
Short: "Securely transfer and send anything between computers.",
17+
Long: "Securely transfer and send anything between computers.",
18+
}
19+
20+
cmd.AddCommand(FilesSendCMD())
21+
22+
return cmd
23+
}
24+
25+
func FilesSendCMD() *cobra.Command {
26+
cmd := &cobra.Command{
27+
Use: "send",
28+
Short: "Send files/directories to remote.",
29+
Long: "Send files/directories to remote.",
30+
Aliases: []string{"s"},
31+
RunE: func(cmd *cobra.Command, args []string) error {
32+
tools.RandomSeed()
33+
34+
err := senderUI.ValidateTranxAddress()
35+
36+
if err != nil {
37+
log.Fatal(err)
38+
}
39+
40+
senderUI.HandleSendCommand(models.TranOptions{
41+
TranxAddress: constants.DEFAULT_ADDRESS,
42+
TranxPort: constants.DEFAULT_PORT,
43+
}, args)
44+
45+
return nil
46+
},
47+
}
48+
49+
return cmd
50+
}

cmd/secman/root.go

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func Execute(f *factory.Factory, version string, buildDate string) *cobra.Comman
6969
app.InfoCMD(version),
7070
app.InsertCMD(),
7171
app.GenerateCMD(),
72+
app.FilesCMD(),
7273
app.ReadCMD(),
7374
app.EditCMD(),
7475
app.ListCMD(),

go.mod

+11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ require (
2424
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739
2525
github.com/scmn-dev/browser v0.1.3
2626
github.com/scmn-dev/get-latest v0.1.2
27+
github.com/scmn-dev/tran v0.0.2
2728
github.com/spf13/cobra v1.4.0
2829
github.com/spf13/pflag v1.0.5
2930
github.com/spf13/viper v1.10.1
@@ -36,14 +37,20 @@ require (
3637
github.com/alecthomas/chroma v0.10.0 // indirect
3738
github.com/atotto/clipboard v0.1.4 // indirect
3839
github.com/aymerick/douceur v0.2.0 // indirect
40+
github.com/charmbracelet/harmonica v0.1.0 // indirect
3941
github.com/containerd/console v1.0.3 // indirect
42+
github.com/disintegration/imaging v1.6.2 // indirect
4043
github.com/dlclark/regexp2 v1.4.0 // indirect
4144
github.com/fatih/color v1.13.0 // indirect
4245
github.com/fsnotify/fsnotify v1.5.1 // indirect
4346
github.com/gorilla/css v1.0.0 // indirect
4447
github.com/gorilla/mux v1.8.0 // indirect
48+
github.com/gorilla/websocket v1.5.0 // indirect
4549
github.com/hashicorp/hcl v1.0.0 // indirect
4650
github.com/inconshreveable/mousetrap v1.0.0 // indirect
51+
github.com/klauspost/compress v1.14.2 // indirect
52+
github.com/klauspost/pgzip v1.2.5 // indirect
53+
github.com/ledongthuc/pdf v0.0.0-20210621053716-e28cb8259002 // indirect
4754
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
4855
github.com/magiconair/properties v1.8.5 // indirect
4956
github.com/mattn/go-runewidth v0.0.13 // indirect
@@ -54,14 +61,18 @@ require (
5461
github.com/pelletier/go-toml v1.9.4 // indirect
5562
github.com/rivo/uniseg v0.2.0 // indirect
5663
github.com/sahilm/fuzzy v0.1.0 // indirect
64+
github.com/schollz/pake/v3 v3.0.4 // indirect
5765
github.com/spf13/afero v1.6.0 // indirect
5866
github.com/spf13/cast v1.4.1 // indirect
5967
github.com/spf13/jwalterweatherman v1.1.0 // indirect
6068
github.com/subosito/gotenv v1.2.0 // indirect
6169
github.com/tidwall/match v1.1.1 // indirect
6270
github.com/tidwall/pretty v1.2.0 // indirect
71+
github.com/tscholl2/siec v0.0.0-20210707234609-9bdfc483d499 // indirect
6372
github.com/yuin/goldmark v1.4.4 // indirect
6473
github.com/yuin/goldmark-emoji v1.0.1 // indirect
74+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
75+
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
6576
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
6677
golang.org/x/text v0.3.7 // indirect
6778
gopkg.in/ini.v1 v1.66.2 // indirect

go.sum

+22
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ github.com/charmbracelet/bubbletea v0.20.0 h1:/b8LEPgCbNr7WWZ2LuE/BV1/r4t5PyYJtD
2828
github.com/charmbracelet/bubbletea v0.20.0/go.mod h1:zpkze1Rioo4rJELjRyGlm9T2YNou1Fm4LIJQSa5QMEM=
2929
github.com/charmbracelet/glamour v0.5.0 h1:wu15ykPdB7X6chxugG/NNfDUbyyrCLV9XBalj5wdu3g=
3030
github.com/charmbracelet/glamour v0.5.0/go.mod h1:9ZRtG19AUIzcTm7FGLGbq3D5WKQ5UyZBbQsMQN0XIqc=
31+
github.com/charmbracelet/harmonica v0.1.0 h1:lFKeSd6OAckQ/CEzPVd2mqj+YMEubQ/3FM2IYY3xNm0=
3132
github.com/charmbracelet/harmonica v0.1.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
3233
github.com/charmbracelet/lipgloss v0.4.0/go.mod h1:vmdkHvce7UzX6xkyf4cca8WlwdQ5RQr8fzta+xl7BOM=
3334
github.com/charmbracelet/lipgloss v0.5.0 h1:lulQHuVeodSgDez+3rGiuxlPVXSnhth442DATR2/8t8=
@@ -39,6 +40,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
3940
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4041
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4142
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
43+
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
44+
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
4245
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
4346
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
4447
github.com/evertras/bubble-table v0.8.4 h1:8VP8IPHASriMQuQYu69PWayHfPNAB3KM8nSwaS6spJ4=
@@ -54,16 +57,24 @@ github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
5457
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
5558
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
5659
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
60+
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
61+
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
5762
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
5863
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
5964
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
6065
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
6166
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
6267
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
68+
github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=
69+
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
70+
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
71+
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
6372
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
6473
github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
6574
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
6675
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
76+
github.com/ledongthuc/pdf v0.0.0-20210621053716-e28cb8259002 h1:9KI9JpkbCm0b/xSjvNyg9O7G27t+cf+L3um6xv1IbNs=
77+
github.com/ledongthuc/pdf v0.0.0-20210621053716-e28cb8259002/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs=
6778
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
6879
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
6980
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
@@ -113,10 +124,14 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
113124
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
114125
github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI=
115126
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
127+
github.com/schollz/pake/v3 v3.0.4 h1:rDNk9MwEVJ/C1+eDCr0DirJfpG+/sAZJ4YsYIyOTkSc=
128+
github.com/schollz/pake/v3 v3.0.4/go.mod h1:Q28rSQCHYzEtMQoi80R1MdpPRgNN/Si2Xdilx4NvsoQ=
116129
github.com/scmn-dev/browser v0.1.3 h1:ddL6bHEZseXPHOPsDEzaHp1PMfekSJ3PUQNib+wIXx8=
117130
github.com/scmn-dev/browser v0.1.3/go.mod h1:3wshMIhDXDjg9C04LwKfAWdZ28TYCWQqqHcTMAh9SHQ=
118131
github.com/scmn-dev/get-latest v0.1.2 h1:e2L3OPAuyvhxTXP5xauVXg0xpkP9QDRipl7qY+mQYF4=
119132
github.com/scmn-dev/get-latest v0.1.2/go.mod h1:zzZlyOQsu3wAM0Mz1udFFaULVLcXF6PpIwUsXD1lhqc=
133+
github.com/scmn-dev/tran v0.0.2 h1:0F6tl27KOPsUvmTfhgqpzC+lNmlHrJxJXX5BiRiFbK4=
134+
github.com/scmn-dev/tran v0.0.2/go.mod h1:kT+oyHd/0bgh9StQ61dIs7WmqsyOrIoKlLr2s+Byo+Y=
120135
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
121136
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
122137
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
@@ -132,6 +147,7 @@ github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8q
132147
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
133148
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
134149
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
150+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
135151
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
136152
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
137153
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -143,6 +159,8 @@ github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
143159
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
144160
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
145161
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
162+
github.com/tscholl2/siec v0.0.0-20210707234609-9bdfc483d499 h1:bPQ48TuiAuGTZDm54H2EV/2+eRRBHP61bKDkKSEPW4A=
163+
github.com/tscholl2/siec v0.0.0-20210707234609-9bdfc483d499/go.mod h1:KL9+ubr1JZdaKjgAaHr+tCytEncXBa1pR6FjbTsOJnw=
146164
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
147165
github.com/yuin/goldmark v1.4.4 h1:zNWRjYUW32G9KirMXYHQHVNFkXvMI7LpgNW2AgYAoIs=
148166
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
@@ -151,6 +169,10 @@ github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGj
151169
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
152170
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
153171
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
172+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE=
173+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
174+
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U=
175+
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
154176
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
155177
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
156178
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=

0 commit comments

Comments
 (0)