{"body":"#!/usr/bin/env perl6\nuse lib \".\";\nuse lib \"lib\";\nuse Settings;\nmy %*SUB-MAIN-OPTS = :named-anywhere;\n\nproto MAIN(\n    Str     $product,                                                                       #= product name (BUMP/GALLERY/...)\n    IO(Str) :$bn                where .d = \".\",                                             #= path to bomnegocio repo\n    IO(Str) :$bconf             where .f = \"$bn/conf/common/bconf/bconf.txt.product_price\", #= path to the product_price bconf\n    Str     :$settings-node     where /<[\\w.-]>+/ = \"*.*.product_price_settings\",           #= settings bconf node\n    |\n) {\n    my $*settings = Settings.new: :$bconf, :node(\"$settings-node.$product\");\n    {*}\n}\n\n#| print the settings\nmulti MAIN($product) {\n    .say for $*settings.lines\n}\n\n#| search a value into the settings\nmulti MAIN($product, \"search\", *%data) {\n    my @a := $*settings.find: %data;\n    say @a;\n}\n\nsubset DataToSet of Str where /[<[\\w-]>+ '=' <-[,]>+]+ % \",\"/;\n\n#| change value\nmulti MAIN(\n    $product,\n    \"set\",\n    DataToSet :$set!, #= format: --set=price=1234.56,another-key=another-value\n    *%data\n) {\n    my %new-data    = $set.split(',').map: { Pair.new: |.split: \"=\" };\n    $*settings.set: %data, %new-data;\n    .say for $*settings.lines\n}\n","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/Z3VyMUSj","modified":1518105526,"id":"Z3VyMUSj","size":1259,"lines":41,"own_paste":false,"theme":"","date":1518105526}