Skip to content

Commit 7384b3d

Browse files
authored
Implement companion modifier (#89)
1 parent f61018d commit 7384b3d

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

docs/src/changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
### Security
1414

15+
## [`v0.3.2` (2022-10-12)](https://github.com/anupli/running-ng/releases/tag/v0.3.2)
16+
### Added
17+
18+
#### Modifiers
19+
- `Companion`
20+
1521
## [`v0.3.1` (2022-09-18)](https://github.com/anupli/running-ng/releases/tag/v0.3.1)
1622
### Added
1723
#### Base Syntax

docs/src/references/modifier.md

+9
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,12 @@ Multiple arguments are space separated.
7272
### Description
7373
Specify a wrapper.
7474
If a wrapper also exist for the benchmark suite you use, this wrapper will follow that.
75+
76+
## `Companion` (preview ⚠️)
77+
### Keys
78+
`val`: a single string with [shell-like syntax](https://docs.python.org/3/library/shlex.html#shlex.split).
79+
Multiple arguments are space separated.
80+
81+
### Description
82+
Specify a companion program.
83+
If a companion program also exist for the benchmark suite you use, this companion program will follow that.

src/running/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = (0, 3, 1)
1+
VERSION = (0, 3, 2)
22
__VERSION__ = '.'.join(map(str, VERSION))

src/running/benchmark.py

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def attach_modifiers(self, modifiers: List[Modifier]) -> Any:
6363
continue
6464
elif type(m) == Wrapper:
6565
b.wrapper.extend(m.val)
66+
elif type(m) == Companion:
67+
b.companion.extend(m.val)
6668
elif type(m) == EnvVar:
6769
b.env_args[m.var] = m.val
6870
elif type(m) == ModifierSet:

src/running/modifier.py

+9
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,12 @@ def __init__(self, value_opts=None, **kwargs):
133133

134134
def __str__(self) -> str:
135135
return "{} JSArg {}".format(super().__str__(), self.val)
136+
137+
@register(Modifier)
138+
class Companion(Modifier):
139+
def __init__(self, value_opts=None, **kwargs):
140+
super().__init__(value_opts, **kwargs)
141+
self.val = split_quoted(self._kwargs["val"])
142+
143+
def __str__(self) -> str:
144+
return "{} Companion {}".format(super().__str__(), self.val)

0 commit comments

Comments
 (0)