Skip to content

Commit 428d2ed

Browse files
committed
Added some basic detection of which folder you are in for dev commands
Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
1 parent fd25054 commit 428d2ed

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/cfengine_cli/dev.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from cfbs.commands import generate_release_information_command
23
from cfengine_cli.utils import UserError
34
from cfengine_cli.dependency_tables import update_dependency_tables
@@ -12,36 +13,39 @@ def _continue_prompt() -> bool:
1213
return answer in ("y", "yes")
1314

1415

15-
def _repo_notice(repo) -> bool:
16+
def _expect_repo(repo) -> bool:
17+
cwd = os.getcwd()
18+
if cwd.endswith(repo):
19+
return True
1620
print(f"Note: This command is intended to be run in the {repo} repo")
1721
print(f" https://github.com/cfengine/{repo}")
1822
answer = _continue_prompt()
1923
return answer
2024

2125

2226
def dependency_tables() -> int:
23-
answer = _repo_notice("buildscripts")
27+
answer = _expect_repo("buildscripts")
2428
if answer:
2529
return update_dependency_tables()
2630
return 1
2731

2832

2933
def docs_format() -> int:
30-
answer = _repo_notice("documentation")
34+
answer = _expect_repo("documentation")
3135
if answer:
3236
return update_docs()
3337
return 1
3438

3539

3640
def docs_check() -> int:
37-
answer = _repo_notice("documentation")
41+
answer = _expect_repo("documentation")
3842
if answer:
3943
return check_docs()
4044
return 1
4145

4246

4347
def release_information() -> int:
44-
answer = _repo_notice("release-information")
48+
answer = _expect_repo("release-information")
4549
if answer:
4650
generate_release_information_command()
4751
return 0

0 commit comments

Comments
 (0)