Skip to content

Commit

Permalink
Merge pull request #8 from heronimus/chore/update-compiler
Browse files Browse the repository at this point in the history
chore: update V compiler compatibility to V 0.4.8 14b1a14
  • Loading branch information
heronimus authored Oct 26, 2024
2 parents 6218bca + 6398233 commit 842d7c1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Consul-Template Plugin: string2files
Lightweight Consul-Template plugin that (basically) write string to file(s). Created because I need easy way to write multiple files from Consul KV tree with only single template :v:.

Build with V language compiler: `V 0.2.4 8315e82`.
*(Update 2024-10-26) Build with V language compiler: `V 0.4.8 14b1a14`*

### Credits
This plugin heavily inspired by:
Expand Down Expand Up @@ -76,7 +76,7 @@ For Example: given below items on Consul KV & Vault Secret:
- Vault Secret:
```
secret/myservices
│ app.conf
│ app.conf
| - app.token "s3cr3t-t0k3n"
└─── db/db.conf
Expand Down
4 changes: 1 addition & 3 deletions filewriter/filewriter.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import log
pub struct FileWriter {
mut:
ofile os.File
logger log.Log = log.Log{
level: .info
}
pub mut:
path string
content string
is_force bool
is_newline bool
logger log.Log = log.Log{}
}
2 changes: 1 addition & 1 deletion filewriter/filewriter_explode.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn explode_data(args map[string]string, flags map[string]bool) {
}
if content_split.len % 2 != 0 {
fw.logger.warn('(${content_split}) k/v pair is not even, ommiting uncomplete k/v.')
content_split = content_split[0..(content_split.len - 1)]
content_split = content_split[0..(content_split.len - 1)].clone()
}
// Loops splited data
for i := 0; i < content_split.len; i += 2 {
Expand Down
5 changes: 3 additions & 2 deletions string2files.v
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ fn main() {
flag: .bool
name: 'force'
abbrev: 'f'
value: ['false']
default_value: ['false']
description: 'Create new directory/file from <path-file> if not exist.'
}
cli_flags << Flag{
flag: .bool
name: 'new-line'
abbrev: 'nl'
value: ['false']
default_value: ['false']
description: 'Add new line in the end of file.'
}
append_cmd.add_flags(cli_flags)
Expand All @@ -71,6 +71,7 @@ fn append_func(cmd Command) ! {
is_force: flag_force
is_newline: flag_newline
}
fw.logger.set_level(.info)
fw.append_file()
}

Expand Down

0 comments on commit 842d7c1

Please sign in to comment.