This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
109 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
author: deadc0de6 (https://github.com/deadc0de6) | ||
Copyright (c) 2024, deadc0de6 | ||
nodes helpers | ||
""" | ||
|
||
import os | ||
|
||
# local imports | ||
from catcli import nodes | ||
|
||
|
||
def path_to_top(path: str) -> str: | ||
"""path pivot under top""" | ||
pre = f"{os.path.sep}{nodes.NAME_TOP}" | ||
if not path.startswith(pre): | ||
# prepend with top node path | ||
path = pre + path | ||
return path | ||
|
||
|
||
def path_to_search_all(path: str) -> str: | ||
"""path to search for all subs""" | ||
if not path: | ||
path = os.path.sep | ||
if not path.startswith(os.path.sep): | ||
path = os.path.sep + path | ||
pre = f"{os.path.sep}{nodes.NAME_TOP}" | ||
if not path.startswith(pre): | ||
# prepend with top node path | ||
path = pre + path | ||
# if not path.endswith(os.path.sep): | ||
# # ensure ends with a separator | ||
# path += os.path.sep | ||
# if not path.endswith(WILD): | ||
# # add wild card | ||
# path += WILD | ||
return path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.