Skip to content

Commit 28baf10

Browse files
committed
Merge branch 'master' of github.com:skx/deployr
2 parents d19c206 + 4ac0bca commit 28baf10

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ The following variables are defined by default:
111111

112112

113113

114-
115114
## Template Expansion
116115

117116
In addition to copying files literally from the local system to the remote
118117
host it is also possible perform some limited template-expansion.
119118

120-
To copy a file literally you'd use the `CopyFile` primitive:
119+
To copy a file literally you'd use the `CopyFile` primitive which copies the
120+
file with no regards to the contents (handling binary content):
121121

122122
CopyFile local.txt /tmp/remote.txt
123123

124-
To copy a file with template-expansion performed upon its contents you use the `CopyTemplate` primitive instead:
124+
To copy a file with template-expansion you should use the `CopyTemplate` primitive instead:
125125

126126
CopyTemplate local.txt /tmp/remote.txt
127127

@@ -136,9 +136,11 @@ which means you can access values like so:
136136
# at {{now.UTC.Day}} {{now.UTC.Month}} {{now.UTC.Year}}
137137
#
138138

139-
In short you write `{{get "variable-name-here}}` and the value of the variable
139+
In short you write `{{get "variable-name-here"}}` and the value of the variable
140140
will be output inline.
141141

142+
Any variable defined with `Set` will be available to you, as well as the
143+
[predefined variables](#predefined-variables) noted above.
142144

143145

144146

parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (p *Parser) GetArguments(expected []token.Token) ([]token.Token, error) {
321321

322322
next := p.Tokenizer.NextToken()
323323
if next.Type != arg.Type {
324-
return nil, fmt.Errorf("Expected %v as argument %d - Got %v", arg.Type, i, next.Type)
324+
return nil, fmt.Errorf("Expected %v as argument %d - Got %v", arg.Type, i+1, next.Type)
325325
}
326326

327327
ret = append(ret, next)

parser/parser_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func TestCopy(t *testing.T) {
213213
t.Fatalf("Expected to receive an error, got none")
214214
}
215215

216-
if !strings.Contains(err.Error(), "as argument 0") {
216+
if !strings.Contains(err.Error(), "as argument 1") {
217217
t.Fatalf("Our error was misleading: %s", err.Error())
218218
}
219219

@@ -238,7 +238,7 @@ func TestCopy(t *testing.T) {
238238
t.Fatalf("Expected to receive an error, got none")
239239
}
240240

241-
if !strings.Contains(err.Error(), "as argument 1") {
241+
if !strings.Contains(err.Error(), "as argument 2") {
242242
t.Fatalf("Our error was misleading %s", err.Error())
243243
}
244244

@@ -421,7 +421,7 @@ func TestSet(t *testing.T) {
421421
t.Fatalf("Expected to receive an error, got none")
422422
}
423423

424-
if !strings.Contains(err.Error(), "as argument 0") {
424+
if !strings.Contains(err.Error(), "as argument 1") {
425425
t.Fatalf("Our error was misleading:%s", err.Error())
426426
}
427427

@@ -446,7 +446,7 @@ func TestSet(t *testing.T) {
446446
t.Fatalf("Expected to receive an error, got none")
447447
}
448448

449-
if !strings.Contains(err.Error(), "as argument 1") {
449+
if !strings.Contains(err.Error(), "as argument 2") {
450450
t.Fatalf("Our error was misleading: %s", err.Error())
451451
}
452452
}

0 commit comments

Comments
 (0)