apply chomp in header tpl + fix exec file perm fo sh headerdef
This commit is contained in:
parent
3f4685db22
commit
6499b5c9d0
|
@ -15,7 +15,7 @@
|
||||||
- sh :
|
- sh :
|
||||||
file :
|
file :
|
||||||
- build.sh
|
- build.sh
|
||||||
startline : 2
|
startline : 2 # to embed shebang before header tpl
|
||||||
sepline :
|
sepline :
|
||||||
motif : "# "
|
motif : "# "
|
||||||
repeat : 40
|
repeat : 40
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
- .vala
|
- .vala
|
||||||
file :
|
file :
|
||||||
- install.vala.in
|
- install.vala.in
|
||||||
|
- main.vala
|
||||||
startline : 1
|
startline : 1
|
||||||
sepline :
|
sepline :
|
||||||
motif : " *"
|
motif : " *"
|
||||||
|
|
22
build.sh
22
build.sh
|
@ -1,31 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : berel <https://git.pluie.org/pluie/berel>
|
# @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
# @version : 0.21
|
# @version : 0.21
|
||||||
# @type : program
|
# @type : program
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
# @author : a-Sansara <[dev]at[pluie]dot[org]>
|
# @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
# @copyright : pluie.org <http://www.pluie.org>
|
# @copyright : pluie.org <http://www.pluie.org>
|
||||||
#
|
#
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# This file is part of berel.
|
# This file is part of berel.
|
||||||
#
|
#
|
||||||
# berel is free software (free as in speech) : you can redistribute it
|
# berel 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
|
# 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,
|
# published by the Free Software Foundation, either version 3 of the License,
|
||||||
# or (at your option) any later version.
|
# or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# berel is distributed in the hope that it will be useful, but WITHOUT
|
# berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
# more details.
|
# more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with berel. If not, see <http://www.gnu.org/licenses/>.
|
# along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
||||||
|
|
||||||
meson --prefix=/usr/local ./ build
|
meson --prefix=/usr/local ./ build
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
namespace Pluie
|
namespace Pluie
|
||||||
|
|
29
main.vala
29
main.vala
|
@ -1,3 +1,32 @@
|
||||||
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
*
|
||||||
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
|
* @version : 0.21
|
||||||
|
* @type : program
|
||||||
|
* @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 berel.
|
||||||
|
*
|
||||||
|
* berel 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.
|
||||||
|
*
|
||||||
|
* berel 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 berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
using Gee;
|
using Gee;
|
||||||
using Pluie;
|
using Pluie;
|
||||||
|
|
22
meson.build
22
meson.build
|
@ -1,30 +1,30 @@
|
||||||
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
#^# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# @software : berel <https://git.pluie.org/pluie/berel>
|
# @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
# @version : 0.21
|
# @version : 0.21
|
||||||
# @type : program
|
# @type : program
|
||||||
# @date : 2018
|
# @date : 2018
|
||||||
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
# @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
# @author : a-Sansara <[dev]at[pluie]dot[org]>
|
# @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
# @copyright : pluie.org <http://www.pluie.org>
|
# @copyright : pluie.org <http://www.pluie.org>
|
||||||
#
|
#
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
#
|
#
|
||||||
# This file is part of berel.
|
# This file is part of berel.
|
||||||
#
|
#
|
||||||
# berel is free software (free as in speech) : you can redistribute it
|
# berel 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
|
# 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,
|
# published by the Free Software Foundation, either version 3 of the License,
|
||||||
# or (at your option) any later version.
|
# or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# berel is distributed in the hope that it will be useful, but WITHOUT
|
# berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
# more details.
|
# more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with berel. If not, see <http://www.gnu.org/licenses/>.
|
# along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #^#
|
||||||
|
|
||||||
project('berel', 'vala', 'c', version:'0.21')
|
project('berel', 'vala', 'c', version:'0.21')
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
@ -93,13 +93,16 @@ public class Pluie.Berel.App
|
||||||
private void write_header (Berel.HeaderDef header)
|
private void write_header (Berel.HeaderDef header)
|
||||||
{
|
{
|
||||||
of.action ("write headers from header def", header.yaml_name);
|
of.action ("write headers from header def", header.yaml_name);
|
||||||
var hasHeader = false;
|
|
||||||
string? data = null;
|
string? data = null;
|
||||||
string? path = null;
|
string? path = null;
|
||||||
foreach (var name in header.file) {
|
foreach (var name in header.file) {
|
||||||
path = Path.build_filename(this.pwd, name);
|
path = Path.build_filename(this.pwd, name);
|
||||||
data = this.get_write_content(path, header);
|
data = this.get_write_content(path, header);
|
||||||
this.write_file (path, data);
|
if (this.write_file (path, data)) {
|
||||||
|
if (header.yaml_name == "sh") {
|
||||||
|
FileUtils.chmod (path, 0775);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach (var name in header.dir) {
|
foreach (var name in header.dir) {
|
||||||
path = Path.build_filename(this.pwd, name);
|
path = Path.build_filename(this.pwd, name);
|
||||||
|
@ -115,16 +118,21 @@ public class Pluie.Berel.App
|
||||||
of.echo (" > reading directory %s".printf (path));
|
of.echo (" > reading directory %s".printf (path));
|
||||||
string? dname = null;
|
string? dname = null;
|
||||||
string? data = null;
|
string? data = null;
|
||||||
Dir dir = Dir.open (path, 0);
|
try {
|
||||||
while ((dname = dir.read_name ()) != null) {
|
Dir dir = Dir.open (path, 0);
|
||||||
string? p = Path.build_filename (path, dname);
|
while ((dname = dir.read_name ()) != null) {
|
||||||
if (FileUtils.test (p, FileTest.IS_DIR))
|
string? p = Path.build_filename (path, dname);
|
||||||
this.write_dir (p, header);
|
if (FileUtils.test (p, FileTest.IS_DIR))
|
||||||
else {
|
this.write_dir (p, header);
|
||||||
data = this.get_write_content(p, header, true);
|
else {
|
||||||
this.write_file (p, data);
|
data = this.get_write_content(p, header, true);
|
||||||
|
this.write_file (p, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(GLib.FileError e) {
|
||||||
|
of.error (e.message);
|
||||||
|
}
|
||||||
of.echo (" < directory %s".printf (path));
|
of.echo (" < directory %s".printf (path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
@ -68,6 +68,6 @@ public class Pluie.Berel.Comment : Yaml.Object
|
||||||
*/
|
*/
|
||||||
public string get_line (string data, bool disabled = false)
|
public string get_line (string data, bool disabled = false)
|
||||||
{
|
{
|
||||||
return "%s%s".printf (disabled ? "" : this.begin, data);
|
return "%s%s".printf (disabled ? "" : this.begin, data).chomp ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
@ -111,7 +111,7 @@ public class Pluie.Berel.Meta : Yaml.Object
|
||||||
sb.append("%s\n".printf (hd.comment.get_line(str, str==hd.sepline.to_string ())));
|
sb.append("%s\n".printf (hd.comment.get_line(str, str==hd.sepline.to_string ())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "%s\n".printf (sb.str.substring (0, sb.str.length - 5 -(hd.sepline.motif[0] == ' ' ? 0 : 1) - hd.comment.end.length)+hd.comment.end);
|
return "%s%s\n".printf (sb.str.substring (0, sb.str.length - 3 - hd.comment.end.length), hd.comment.end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,20 +119,25 @@ public class Pluie.Berel.Meta : Yaml.Object
|
||||||
*/
|
*/
|
||||||
public string tpl_replace_var (HeaderDef hd)
|
public string tpl_replace_var (HeaderDef hd)
|
||||||
{
|
{
|
||||||
MatchInfo? mi = null;
|
|
||||||
Regex reg = new Regex ("\\^([^\\^]+)\\^");
|
|
||||||
string str = this.tpl;
|
string str = this.tpl;
|
||||||
this.varlist = new Gee.HashMap<string, string> ();
|
this.varlist = new Gee.HashMap<string, string> ();
|
||||||
if (reg.match (str, 0, out mi)) {
|
try {
|
||||||
this.define_var (mi.fetch (1), hd);
|
MatchInfo? mi = null;
|
||||||
while (mi.next ()) {;
|
Regex reg = new Regex ("\\^([^\\^]+)\\^");
|
||||||
|
if (reg.match (str, 0, out mi)) {
|
||||||
this.define_var (mi.fetch (1), hd);
|
this.define_var (mi.fetch (1), hd);
|
||||||
|
while (mi.next ()) {;
|
||||||
|
this.define_var (mi.fetch (1), hd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var entry in this.varlist.entries) {
|
||||||
|
if (entry.value.length > 0) {
|
||||||
|
str = str.replace("^%s^".printf (entry.key), (entry.key == "sepline" ? "" : "")+entry.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var entry in this.varlist.entries) {
|
catch (GLib.RegexError e) {
|
||||||
if (entry.value.length > 0) {
|
of.error (e.message);
|
||||||
str = str.replace("^%s^".printf (entry.key), (entry.key == "sepline" ? "" : "")+entry.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -186,14 +191,14 @@ public class Pluie.Berel.Meta : Yaml.Object
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (var bk in this.keys) {
|
foreach (var bk in this.keys) {
|
||||||
sb.append (hd.comment.get_line("@%s%s : %s%s%s%s".printf (
|
sb.append (hd.comment.get_line("@%s%s : %s%s%s".printf (
|
||||||
bk.yaml_name,
|
bk.yaml_name,
|
||||||
string.nfill(lenk+2-bk.yaml_name.length, ' '),
|
string.nfill(lenk+2-bk.yaml_name.length, ' '),
|
||||||
bk.name,
|
bk.name,
|
||||||
string.nfill(len+2-bk.name.length, ' '),
|
string.nfill(len+2-bk.name.length, ' '),
|
||||||
bk.address != null ? " %s".printf (bk.address) : "",
|
bk.address != null ? " %s".printf (bk.address) : ""
|
||||||
count == this.keys.size -1 ? "" : "\n"
|
|
||||||
),count++ == 0));
|
),count++ == 0));
|
||||||
|
sb.append ("\n");
|
||||||
}
|
}
|
||||||
return sb.str;
|
return sb.str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/*^* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* @software : berel <https://git.pluie.org/pluie/berel>
|
* @software : berel <https://git.pluie.org/pluie/berel>
|
||||||
* @version : 0.21
|
* @version : 0.21
|
||||||
* @type : program
|
* @type : program
|
||||||
* @date : 2018
|
* @date : 2018
|
||||||
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
* @license : GPLv3.0 <http://www.gnu.org/licenses/>
|
||||||
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
* @author : a-Sansara <[dev]at[pluie]dot[org]>
|
||||||
* @copyright : pluie.org <http://www.pluie.org>
|
* @copyright : pluie.org <http://www.pluie.org>
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* This file is part of berel.
|
* This file is part of berel.
|
||||||
*
|
*
|
||||||
* berel is free software (free as in speech) : you can redistribute it
|
* berel 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
|
* 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,
|
* published by the Free Software Foundation, either version 3 of the License,
|
||||||
* or (at your option) any later version.
|
* or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* berel is distributed in the hope that it will be useful, but WITHOUT
|
* berel is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
* along with berel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *^*/
|
||||||
|
|
||||||
using GLib;
|
using GLib;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user