August 25, 2023

Hi All,

Request your help on reading a yaml file using dyaml.

input.yaml

name: "This is test Program"
program:
    prg: "whoami"
    args: "/?"
    env:
    config:
    flag:
    workdir:
    shellPath:

Program:

import dyaml;
import std.stdio;

void main () {
	
Node config;
    config = Loader.fromFile("input.yml").load();
    string program = config["program"]["prg"].as!string;
    string[] args = config["program"]["args"].as!(string[]);
    string[string] env = config["program"]["env"].as!(string[string]);
    std.process.Config config = config["program"]["configs"].as!(Config);
    std.process.Config.Flags flag = config["program"]["flag"].as!(Flags);
    string workdir = config["program"]["workdir"].as!string;
    string shell = config["program"]["shellPath"].as!string;

     writeln(args);
     writeln(env);
     writeln(config);
     writeln(flag);
}

From,
Vino