-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for aliases to
ov
(#4409)
- Loading branch information
1 parent
1f24ba1
commit c4cb14e
Showing
5 changed files
with
55 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ logs/ | |
|
||
# Environment | ||
.env | ||
.ovprofile | ||
.ov_aliases.json | ||
|
||
# Python environments | ||
env/ | ||
|
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,28 @@ | ||
import json | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
SHARED_ALIASES = { | ||
"j": ["just"], | ||
"nuxt": ["j", "p", "frontend", "dev"], | ||
} | ||
|
||
|
||
def expand_aliases(args: list[str]): | ||
ov_aliases = Path(os.getenv("OPENVERSE_PROJECT")) / ".ov_aliases.json" | ||
aliases = SHARED_ALIASES | ||
if ov_aliases.is_file(): | ||
aliases |= json.loads(ov_aliases.read_text()) | ||
|
||
args = sys.argv[1:] | ||
|
||
while args[0] in aliases: | ||
args = aliases.pop(args[0]) + args[1:] | ||
|
||
print(*args) | ||
|
||
|
||
if __name__ == "__main__": | ||
expand_aliases(sys.argv[1:]) |
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