Replies: 2 comments 1 reply
-
I also tried this
the result is
|
Beta Was this translation helpful? Give feedback.
-
While this won't answer your first stated goal, hopefully it answers your 3 questions. For your first question, you can use For Q2, see For Q3, see package main
#file: {
name: string
content: string
}
files: [...#file] & [
{ name: "a" },
{ name: "b" },
]
F1: [for i, f in files { "i": i, "name": files[i].name }]
F2: {
for f in files {
"file-\(f.name)": f
}
}
F3: F2["file-\(files[0].name)"]
F4: F2."file-a" You'll probably want to build up the data within the commands, and then use Something like this perhaps (combined with the above): package main
import (
"encoding/yaml"
"tool/cli"
"tool/file"
)
command: gen: {
results: {
for f in files {
"file-\(f.name)": file.Read & {
filename: "\(f.name).txt"
contents: string
}
}
}
Files: [ for f in files {
f & { contents: results["file-\(f.name)"].contents }
}]
print: cli.Print & {
text: yaml.Marshal(Files)
}
} |
Beta Was this translation helpful? Give feedback.
-
moving conversation from an issue #1276
I have a list of users under
_users
key. Each user is a structure which has a_ssh_authorized_keys
key. The_ssh_authorized_keys
is a list. My goal is to develop a cue tool which would inject thessh_key
into_users[name]._ssh_authorized_keys[*]
.Here is the code structure
I am trying to produce the following output to the console.
given the:
Questions:
_users[user.name]._ssh_authorized_keys: "something"
doesn't work)?"key-\(user.name)".key
doesn't work)?_users[idx]
to refer to the user structure?Beta Was this translation helpful? Give feedback.
All reactions