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

Commit

Permalink
feature: finish from secman files receive command
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Mar 18, 2022
1 parent c8a50ff commit 7ebba81
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions app/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/abdfnx/tran/tools"
"github.com/scmn-dev/tran/models"
"github.com/scmn-dev/tran/constants"
senderUI "github.com/scmn-dev/tran/tui"
tranUI "github.com/scmn-dev/tran/tui"
)

func FilesCMD() *cobra.Command {
Expand All @@ -18,6 +18,7 @@ func FilesCMD() *cobra.Command {
}

cmd.AddCommand(FilesSendCMD())
cmd.AddCommand(FilesReceiveCMD())

return cmd
}
Expand All @@ -31,13 +32,13 @@ func FilesSendCMD() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
tools.RandomSeed()

err := senderUI.ValidateTranxAddress()
err := tranUI.ValidateTranxAddress()

if err != nil {
log.Fatal(err)
}

senderUI.HandleSendCommand(models.TranOptions{
tranUI.HandleSendCommand(models.TranOptions{
TranxAddress: constants.DEFAULT_ADDRESS,
TranxPort: constants.DEFAULT_PORT,
}, args)
Expand All @@ -48,3 +49,27 @@ func FilesSendCMD() *cobra.Command {

return cmd
}

func FilesReceiveCMD() *cobra.Command {
cmd := &cobra.Command{
Use: "receive",
Short: "Receive files/directories from remote",
Long: "Receive files/directories from remote",
RunE: func(cmd *cobra.Command, args []string) error {
err := tranUI.ValidateTranxAddress()

if err != nil {
return err
}

tranUI.HandleReceiveCommand(models.TranOptions{
TranxAddress: constants.DEFAULT_ADDRESS,
TranxPort: constants.DEFAULT_PORT,
}, args[0])

return nil
},
}

return cmd
}

0 comments on commit 7ebba81

Please sign in to comment.