mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 23:55:46 +02:00
Merge pull request #144 from stijndcl/fix-db-script-runner
Fix db script runner
This commit is contained in:
commit
9a64523baa
2 changed files with 9 additions and 3 deletions
2
.flake8
2
.flake8
|
|
@ -32,7 +32,7 @@ max-line-length = 120
|
|||
# Disable some rules for entire files
|
||||
per-file-ignores =
|
||||
# DALL000: Missing __all__, main isn't supposed to be imported
|
||||
main.py: DALL000,
|
||||
main.py: DALL000, run_db_scripts.py: DALL000,
|
||||
# DALL000: Missing __all__, Cogs aren't modules
|
||||
./didier/cogs/*: DALL000,
|
||||
# DALL000: Missing __all__, tests aren't supposed to be imported
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ import importlib
|
|||
import sys
|
||||
from typing import Callable
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
async def main():
|
||||
"""Try to parse all command-line arguments into modules and run them sequentially"""
|
||||
scripts = sys.argv[1:]
|
||||
if not scripts:
|
||||
print("No scripts provided.", file=sys.stderr)
|
||||
|
|
@ -20,8 +22,12 @@ if __name__ == "__main__":
|
|||
|
||||
try:
|
||||
script_main: Callable = module.main
|
||||
asyncio.run(script_main())
|
||||
await script_main()
|
||||
print(f"Successfully ran {script}")
|
||||
except AttributeError:
|
||||
print(f'Script "{script}" not found.', file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue