Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file exists for multi-system support

# default file behaviour
* text=auto

# make all '.sh' files LF, regardless of users' OS
*.sh text eol=lf
20 changes: 16 additions & 4 deletions easy_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
import sys
from shlex import quote

BASE_DOCKER_COMMAND = "OIOIOI_UID=$(id -u) docker compose" + " -f docker-compose-dev.yml"
if sys.platform == "win32":
# for Windows, a different syntax command_prefix is needed
command_prefix = "set OIOIOI_UID=1000 &&"
else:
command_prefix = "OIOIOI_UID=$(id -u)"

BASE_DOCKER_COMMAND = f"{command_prefix} docker compose" + " -f docker-compose-dev.yml"

RAW_COMMANDS = [
("build", "Build OIOIOI container from source.", "build", True),
Expand Down Expand Up @@ -132,15 +138,22 @@ def get_action_from_gui() -> Option:
),
]
answers = inquirer.prompt(questions)
return answers["action"]
return COMMANDS[answers["action"]]


def run_command(command) -> None:
print("Running command", command)
if not NO_INPUT:
width = os.get_terminal_size().columns
print("=" * width)
sys.exit(os.WEXITSTATUS(os.system(command)))


if sys.platform == "win32":
# for Windows, a different syntax for exiting is needed
exit_code = os.system(command)
sys.exit(exit_code)
else:
sys.exit(os.WEXITSTATUS(os.system(command)))


def warn_user(action: Option) -> bool:
Expand Down Expand Up @@ -189,6 +202,5 @@ def main() -> None:
except Exception as e:
print(f"An error occurred during execution: {e}", file=sys.stderr)


if __name__ == "__main__":
main()