Skip to content

Commit 9b9d617

Browse files
authored
fix: strip at char from beginning of commands (#22)
1 parent 0668368 commit 9b9d617

File tree

9 files changed

+14
-11
lines changed

9 files changed

+14
-11
lines changed

Justfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ include-file-flt:
8686
sys.stdout.write(entry)
8787

8888
update-examples:
89-
just run examples/02.mk > examples/02-tasks.py
90-
git status examples/02-tasks.py || git commit -m "updatetd example 02"
89+
just run test/02.mk > examples/02-tasks.py
90+
git status examples/02-tasks.py || git commit -m "update 02-tasks.py"
9191

9292
update-readme:
9393
just include-file-flt < readme.tmpl.md > README.md

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Demake
22

3-
Version 0.1.2
3+
Version 0.1.3
44

55
## Overview
66

@@ -68,7 +68,7 @@ dev-init: .check-poetry deps quick-test ## prepare project ready for development
6868

6969
.PHONY: .check-poetry
7070
.check-poetry:
71-
command -v poetry 2>/dev/null || (echo "poetry not found, please see https://python-poetry.org/docs/#installation"; exit 1)
71+
@command -v poetry 2>/dev/null || (echo "poetry not found, please see https://python-poetry.org/docs/#installation"; exit 1)
7272

7373
.PHONY: deps
7474
deps: ## install dependencies

bumpver.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpver]
2-
current_version = "0.1.2"
2+
current_version = "0.1.3"
33
version_pattern = "MAJOR.MINOR.PATCH"
44
commit_message = "bump version {old_version} -> {new_version}"
55
commit = true

examples/02.mk

-1
This file was deleted.

package.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: demake
3-
version: 0.1.2
3+
version: 0.1.3
44
github: edvardm/demake
55
license: MIT
66
author: Edvard Majakari

readme.tmpl.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Demake
22

3-
Version 0.1.2
3+
Version 0.1.3
44

55
## Overview
66

@@ -60,7 +60,7 @@ If you don't have Stack setup already, I recommend using
6060
With Makefile contents of
6161

6262
```Makefile
63-
{! examples/02.mk !}
63+
{! test/02.mk !}
6464
```
6565

6666
Resulting output:

src/PyEncode.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ instance Encodable InvCmd where
155155
<> fromText ")"
156156
<> nl
157157
where
158-
formatCmd = fStringFmt . (escape . T.unpack) . rmNlsTabs
158+
formatCmd = fStringFmt . (escape . T.unpack) . stripAtChar . rmNlsTabs
159159
rmNlsTabs = T.replace "\t" "" . T.replace "\\\n" " "
160+
stripAtChar = T.dropWhile (== '@')
160161
fStringFmt src =
161162
let re = [RE.re|\$\($(.*?)\)|]
162163
subst =

test/02.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dev-init: .check-poetry deps quick-test ## prepare project ready for development
66

77
.PHONY: .check-poetry
88
.check-poetry:
9-
command -v poetry 2>/dev/null || (echo "poetry not found, please see https://python-poetry.org/docs/#installation"; exit 1)
9+
@command -v poetry 2>/dev/null || (echo "poetry not found, please see https://python-poetry.org/docs/#installation"; exit 1)
1010

1111
.PHONY: deps
1212
deps: ## install dependencies

test/Spec.hs

+3
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ main = hspec $ do
261261
it "double-escapes escaped quotes in commands" $ do
262262
asString (InvCmd "ls \"fname\"") `shouldBe` " c.run('ls \"fname\"')\n"
263263

264+
it "ignores preceding at-char in commands" $ do
265+
asString (InvCmd "@touch $!") `shouldBe` " c.run('touch $!')\n"
266+
264267
describe "Comments" $ do
265268
it "renders comments" $ do
266269
pending

0 commit comments

Comments
 (0)