forked from FactomProject/walletapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.go
56 lines (43 loc) · 1.04 KB
/
script.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
// Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"fmt"
fct "github.com/FactomProject/factoid"
"os"
"time"
// "golang.org/x/crypto/ssh/terminal"
)
var _ = fmt.Println
var _ fct.Transaction
var _ = time.Now
/*************************************************************
* run a Script
*************************************************************/
type Run struct {
}
var _ ICommand = (*Run)(nil)
func (r Run) Execute(state IState, args []string) error {
if len(args) != 2 {
return fmt.Errorf("Wrong number of arguments")
}
f, err := os.Open(args[1])
if err != nil {
return err
}
run(state, bufio.NewReader(f), false)
return nil
}
func (r Run) Name() string {
return "run"
}
func (Run) ShortHelp() string {
return "Run <filename> -- Executes the script of the given filename"
}
func (Run) LongHelp() string {
return `
Run <filename> Executes the script of the given filename
`
}