pluie-yaml/samples/yaml-imports.vala

94 lines
3.3 KiB
Vala
Raw Normal View History

2018-09-05 00:19:54 +00:00
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
* @version : 0.60
* @type : library
* @date : 2018
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
* @author : a-Sansara <[dev]at[pluie]dot[org]>
* @copyright : pluie.org <http://www.pluie.org>
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* This file is part of pluie-yaml.
*
* pluie-yaml is free software (free as in speech) : you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
2018-08-01 13:10:12 +00:00
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
2018-08-18 23:18:55 +00:00
* @software : pluie-yaml <https://git.pluie.org/pluie/lib-yaml>
* @version : 0.5
* @type : library
2018-08-01 13:10:12 +00:00
* @date : 2018
* @licence : GPLv3.0 <http://www.gnu.org/licenses/>
* @author : a-Sansara <[dev]at[pluie]dot[org]>
* @copyright : pluie.org <http://www.pluie.org/>
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
2018-08-18 23:18:55 +00:00
* This file is part of pluie-yaml.
2018-08-01 13:10:12 +00:00
*
2018-08-18 23:18:55 +00:00
* pluie-yaml is free software (free as in speech) : you can redistribute it
2018-08-01 13:10:12 +00:00
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
2018-08-18 23:18:55 +00:00
* pluie-yaml is distributed in the hope that it will be useful, but WITHOUT
2018-08-01 13:10:12 +00:00
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
2018-08-18 23:18:55 +00:00
* along with pluie-yaml. If not, see <http://www.gnu.org/licenses/>.
2018-08-01 13:10:12 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
2018-08-18 23:18:55 +00:00
2018-07-30 16:25:03 +00:00
using GLib;
using Gee;
using Pluie;
int main (string[] args)
{
Echo.init(false);
2018-07-30 16:25:03 +00:00
var path = Yaml.DATA_PATH + "/main.yml";
2018-08-02 07:38:05 +00:00
var done = false;
2018-07-30 16:25:03 +00:00
2018-08-01 14:44:07 +00:00
of.title ("Pluie Yaml Library", Pluie.Yaml.VERSION, "a-sansara");
2018-08-02 07:38:05 +00:00
Pluie.Yaml.DEBUG = false;
2018-08-02 21:44:36 +00:00
var config = new Yaml.Config (path, true);
2018-08-02 07:38:05 +00:00
var spath = "^imports";
var node = config.get (spath);
if ((done = node != null)) {
2018-08-02 21:44:36 +00:00
spath = "db.therapy.dbname{0}";
2018-08-02 16:57:16 +00:00
of.action ("retriew imported node from Yaml.Config", spath);
var inode = config.get (spath);
2018-08-02 21:44:36 +00:00
if ((done = inode != null)) {
2018-08-02 16:57:16 +00:00
of.echo (inode.to_string (false));
}
2018-07-30 16:25:03 +00:00
}
2018-08-02 16:57:16 +00:00
var root = config.root_node ();
root.display_childs ();
of.rs (done);
2018-07-30 16:25:03 +00:00
of.echo ();
2018-08-02 07:38:05 +00:00
2018-07-30 16:25:03 +00:00
return (int) done;
}