sylixos-uploader/cmd/root.go

69 lines
1.7 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.
Konwn-Behavior:
1. Upload project to device.
2. On Remote device, ELF executable or shared object file will be chmod to 0755.
3. On Remote device, konwn executable script (e.g. .sh, .py, .lua, etc) will be chmod to 0755.
4. Generate upload yaml file from real evo project.
5. Generate environment variables on linux from IDE projects.
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
Generate-Ide-Env-Example:
source <(sylixos-uploader gen-ide-env --workspace ~/sylixos-workspace)
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.
}