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]
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'
lg = "!f() { x=${1-6};\
length=$(expr $x + 8);\

View file

@ -26,24 +26,25 @@ let
(_, pkgName) = root.splitPath()
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":
## Usage: nim fmt
for file in walkDirRec(root, {pcFile, pcDir}):
if file.splitFile().ext == ".nim":
let
# https://github.com/nim-lang/Nim/issues/6262#issuecomment-454983572
# https://stackoverflow.com/a/2406813/1219634
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)
let srcFiles = projectGorgeEx(r"nimgrep --filenames -r '^src/.*\.nim$' --noColor").split("\n")[0..^2]
for file in srcFiles:
let cmd = "nimpretty $1" % [file]
echo "Running $1 .." % [cmd]
exec(cmd)
setCommand("nop")
task i, "install package":
exec "nimble install"
setCommand("nop")
task lexidInc, "bump lexigraphic id":

View file

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