Compare commits

...

3 commits

Author SHA1 Message Date
d9f8007e1e
more words 2023-11-25 01:20:48 -06:00
d2b0dad988
improved nim fmt 2023-11-25 01:20:45 -06:00
bd9234012f
adjust git log format 2023-11-25 01:20:36 -06:00
3 changed files with 28 additions and 13 deletions

View file

@ -32,7 +32,7 @@ autoSetupRemote = true
[alias] [alias]
adog = log --all --decorate --oneline --graph adog = log --all --decorate --oneline --graph
l = log --format=tformat:'%C(bold magenta)%h%C(reset) 🠞 %C(bold)%s%C(reset) ⋅ %C(green)<%ar>%C(reset) ⋅ %C(black)%aN%C(reset)%C(auto)%+d%C(reset)' l = log --format=tformat:'%C(bold magenta)%h%C(reset) 🠞 %C(bold)%s%C(reset) ⋅ %C(green)<%ar>%C(reset) ⋅ %C(dim white)%aN%C(reset)%C(auto)%+d%C(reset)'
lf = log --graph --format=tformat:'%C(bold yellow)%h%C(reset) %C(cyan)%aD%C(reset) %C(green)(%ar) %C(dim white)%aN%C(reset)%w(0,0,9)%n %C(bold)%s%C(auto)%+d%C(reset)%w(0,0,10)%+b' lf = log --graph --format=tformat:'%C(bold yellow)%h%C(reset) %C(cyan)%aD%C(reset) %C(green)(%ar) %C(dim white)%aN%C(reset)%w(0,0,9)%n %C(bold)%s%C(auto)%+d%C(reset)%w(0,0,10)%+b'
lg = "!f() { x=${1-6};\ lg = "!f() { x=${1-6};\
length=$(expr $x + 8);\ length=$(expr $x + 8);\

View file

@ -26,24 +26,25 @@ let
(_, pkgName) = root.splitPath() (_, pkgName) = root.splitPath()
srcFile = root / "src" / (pkgName & ".nim") srcFile = root / "src" / (pkgName & ".nim")
proc projectGorgeEx(cmd: string): string =
## cd into the project before running any commands
let (output, code) = gorgeEx(fmt"cd {getCurrentDir()} && {cmd}")
if code != 0: echo "ERROR executing: " & cmd; quit 1
return output
task fmt, "Run nimpretty on all git-managed .nim files in the current repo": task fmt, "Run nimpretty on all git-managed .nim files in the current repo":
## Usage: nim fmt ## Usage: nim fmt
for file in walkDirRec(root, {pcFile, pcDir}): let srcFiles = projectGorgeEx(r"nimgrep --filenames -r '^src/.*\.nim$' --noColor").split("\n")[0..^2]
if file.splitFile().ext == ".nim": for file in srcFiles:
let let cmd = "nimpretty $1" % [file]
# https://github.com/nim-lang/Nim/issues/6262#issuecomment-454983572 echo "Running $1 .." % [cmd]
# https://stackoverflow.com/a/2406813/1219634 exec(cmd)
fileIsGitManaged = gorgeEx("cd $1 && git ls-files --error-unmatch $2" % [getCurrentDir(), file]).exitCode == 0
# ^^^^^-- That "cd" is required.
if fileIsGitManaged:
let
cmd = "nimpretty $1" % [file]
echo "Running $1 .." % [cmd]
exec(cmd)
setCommand("nop") setCommand("nop")
task i, "install package": task i, "install package":
exec "nimble install" exec "nimble install"
setCommand("nop")
task lexidInc, "bump lexigraphic id": task lexidInc, "bump lexigraphic id":

View file

@ -19,3 +19,17 @@ Nim
Interop Interop
interop interop
backends backends
https
https
Lemmy
Kbin
Lemmy
Murderbot
Diaires
Blacktongue
Witcher
Locklands
Shorefall
Foundryside
DNFs
barebones