28 lines
909 B
Python
Executable file
28 lines
909 B
Python
Executable file
#!/usr/bin/env python
|
|
import argparse
|
|
from subprocess import check_call
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
description="Used to set the current docs version. Doesn't commit changes.")
|
|
parser.add_argument("version",
|
|
help="The new docs version")
|
|
args = parser.parse_args()
|
|
version = args.version
|
|
|
|
# make sure we have no dirty files in this branch (might throw off `make update`)
|
|
check_call("git clean -dfx", shell=True)
|
|
|
|
# edit the file
|
|
with open("libbeat/docs/version.asciidoc", "r") as f:
|
|
lines = f.readlines()
|
|
for i, line in enumerate(lines):
|
|
if line.startswith(":stack-version:"):
|
|
lines[i] = ":stack-version: {}\n".format(version)
|
|
with open("libbeat/docs/version.asciidoc", "w") as f:
|
|
f.writelines(lines)
|
|
|
|
check_call("make update", shell=True)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|