60 lines
1.3 KiB
Go
60 lines
1.3 KiB
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
WorkSpacePath string
|
|
ProjectPath string
|
|
BasePrjPath string
|
|
Device string
|
|
UploadMethod string
|
|
)
|
|
|
|
// RootCmd is the base command for the CLI
|
|
var RootCmd = &cobra.Command{
|
|
Use: "sylixos-uploader",
|
|
Short: "SylixOS uploader",
|
|
Long: `A command-line tool for uploading SylixOS projects via CORBA.
|
|
|
|
Konwn-Issue:
|
|
1. Only support upload ftp now.
|
|
2. File stat on remote device is not same as local (Please chmod on device!).
|
|
|
|
Upload-Example:
|
|
sylixos-uploader upload --path ~/sylixos-workspace/base-project --device 10.13.16.250 --method ftp
|
|
|
|
Generate-Yaml-Example:
|
|
sylixos-uploader gen-yaml --path ~/sylixos-workspace/base-project
|
|
|
|
Yaml-file-Demo:
|
|
"
|
|
base-settings:
|
|
project-name: app_test
|
|
project-type: SylixOSAppProject
|
|
$(ProjectPath): /home/user/sylixos-workspace/app_test
|
|
$(Output): Release
|
|
remote-settings:
|
|
ipaddr: 10.7.130.102
|
|
work-path: /apps/app_test
|
|
protocol: ftp
|
|
upload-pair:
|
|
- local--path: $(ProjectPath)/$(Output)/strip
|
|
remote-path: /usr/bin
|
|
"`,
|
|
}
|
|
|
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
|
func Execute() {
|
|
if err := RootCmd.Execute(); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
// You can define persistent flags and configuration settings here if needed.
|
|
}
|