Hi Christian,
Feel free to use my procedure to read variables from shell-like conf files (receipts, slitaz.conf etc):
http://hg.slitaz.org/nim-tools/file/b701d0b23859/tazpanel/tazpanel_inc.nim#l8
There you can see examples of using this procedure.
Hi Christian,
Feel free to use my procedure to read variables from shell-like conf files (receipts, slitaz.conf etc):
http://hg.slitaz.org/nim-tools/file/b701d0b23859/tazpanel/tazpanel_inc.nim#l8
There you can see examples of using this procedure.
At the moment, it is 'in process'. Take a look at this:
http://hg.slitaz.org/nim-tools/file/b701d0b23859/tazpkg-web/i18n.nim
But I plan to rewrite these procedures.
G*(msgid: string): string
G*(msgid: string, msgnum: int): string
G*(msgid: string, variable: string): string
G*(msgid: string, variables: openarray[string]): string
getLang: string # from env variables
getPlural(lang: string, n: int): int # get plural form
getVarNum(msgid: string): int # get number of used variables
getUALang: string # from browser environment
setLang(UALangs: string) # set available preferred language
...
PS: Application of current procedures (I mean G"...") here:
http://hg.slitaz.org/nim-tools/file/b701d0b23859/tazpkg-web/page.nim
import os, osproc, strutils, parseopt, strtabs
const printVarsScript = "/tmp/printVars.sh "
proc createScript(): void =
if existsFile(printVarsScript.strip) != true:
echo("Creating script")
writeFile(printVarsScript.strip,
"#!/bin/sh \n" &
"tmpa=/tmp/a \n" &
"tmpb=/tmp/b \n" &
"set -a \n" &
"env > $tmpa \n" &
". $1 \n" &
"env > $tmpb \n" &
"diff $tmp{a,b} | sed -ne 's/^> //p' \n" &
"rm $tmp{a,b} \n")
return
proc confVar*(confFile: string): PStringTable =
createScript()
var
command = "sh " & printVarsScript & confFile
commandResult = execCmdEx(command)
rawVars = commandResult.output.strip
result = newStringTable(modeCaseSensitive)
for line in splitLines(rawVars) :
var
lineSplit = split(line, '=')
result[lineSplit[0]] = lineSplit[1]
return
Hi Christian,
ok, I'll see your code. I want to go to work.
Sorry about the bad formatting, I did not know where to put it in the source tree so I pasted it here
I think that Trixar_za would not be against ;) Trixarian Pastebin
Or any other Pastebin (search). Just leave your link here.
There is also http://irc.slitaz.org/paste/ - paste.slitaz.org is still broken though, but that's the same site ;)
Oh, I recall! I have an old account on pastebin.com.
Here is Christian's code: http://pastebin.com/1MqPaarC
We can edit it (if it need).
@Trixar_za: http://paste.slitaz.org/ should work now.
@Bellard Still prefer OpenPastebin (https://github.com/xanmanning/Knoxious-Open-Pastebin) to Zerobin - Both use Flatfile databases (well, technically OpenPastebin can use MySQL or Flatfile)
The most impressive features about Zerobin is that it allows comments, encrypts the data and can 'burn after read'.
Note that your can force the key: http://paste.slitaz.org/?e9327da47b8aa373#SliTaz=
@Aleksej
There is work on a rewrite of tazpkg using spk. You can look at spk code here:
http://hg.slitaz.org/spk/
I also don't like the idea of rewriting everything in nimrod. Only cause i spent most of my time in shell. I move from archlinux two years ago to slitaz cause none of the tools was compiled in C or was binaries.
I'm also working on slitaz-tank iso thats going to become a new sub project of slitaz. I can't make changes quick changes to stuff in pkgs.slitaz.org if parts of it are compiled binaries when doing testing in VM.
I prefer we just stick to bash code and just make the bash code better.
Such messages make my heart cry. The transition was untimely and unnecessary for any of the developers. 2-3 more of these messages, and all will be over, so is really not begun.
You must log in to post.