Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[all] add version command #141

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions all.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ def trace(lang: str, rom: Path) -> bool:
print(f"{lang:>5s}: {GREEN}Wrote {lang}.cpu{END}")
return True

def version(lang: str) -> bool:
proc = subprocess.run(
[f"./version.sh"],
cwd=lang,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
v = proc.stdout.strip()
if proc.returncode != 0:
print(f"{lang:>5s}: {RED}{v}{END}")
return False
else:
print(f"{lang:>5s}: {GREEN}{v}{END}")
return True

def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -247,6 +263,9 @@ def main() -> int:
if args.command == "trace":
results = p.starmap(trace, [(l, args.test_rom) for l in args.langs])

if args.command == "version":
results = p.starmap(version, [(l, ) for l in args.langs])

if all(results):
return 0
else:
Expand Down
2 changes: 2 additions & 0 deletions c/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
cc --version | head -n 1
2 changes: 2 additions & 0 deletions cpp/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
cpp --version | head -n 1
2 changes: 2 additions & 0 deletions go/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
go version
2 changes: 2 additions & 0 deletions nim/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
nim --version | head -n 1
2 changes: 2 additions & 0 deletions php/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
php --version | head -n 1
2 changes: 2 additions & 0 deletions pxd/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
python --version
2 changes: 2 additions & 0 deletions py/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
python --version
2 changes: 2 additions & 0 deletions rs/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
cargo --version
2 changes: 2 additions & 0 deletions zig/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
zig version
Loading