-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
64 lines (51 loc) · 1.35 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"importdim/helpers"
_ "importdim/helpers"
"log"
"os"
"strings"
"time"
)
func main() {
currentDir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
path, err := helpers.GetOptions(os.Args[1:], currentDir)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fileList, err := helpers.FindFilesByPath(path, "*.csv")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
params, err := helpers.CheckFilesFormat(fileList)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
utility := "C:\\Middleware\\user_projects\\epmsystem1\\Planning\\planning1\\OutlineLoad.cmd"
var dim, app, importFile string
logFile := fmt.Sprintf("%s\\epmpi_%s.log", currentDir, time.Now().Format("20060102_150405"))
fmt.Printf("\n\nLog file is located: %s\n\n", logFile)
logFile = fmt.Sprintf("%q", logFile)
passFile := "C:\\epmpi\\enc_pass"
passFile = fmt.Sprintf("%q", passFile)
// Elevate Privileges to Administrator level
if !helpers.AmIAdmin() {
helpers.ElevateAsAdmin()
}
fmt.Println("\nThe following files were found to be imported:")
for i := range params {
fmt.Printf("%d: %s\n\n", i, params[i])
dim = strings.TrimSpace(params[i][0])
app = strings.TrimSpace(params[i][1])
importFile = fmt.Sprintf("%q", params[i][2])
helpers.StartImport(utility, dim, app, passFile, importFile, logFile)
}
//time.Sleep(1*time.Second)
}