mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
Rework __main__.py to follow best practices (#1124)
It also simplifies how the `main()` function could be tested.
This commit is contained in:
1 parent
c50e287c57
commit
4ff22defe4
2 files changed
+6
-10
No files matched your search
+4
-4
@@ -1,7 +1,6 @@
|
||||
"""The main entry point. Invoke as `http' or `python -m httpie'.
|
||||
|
||||
"""
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
@@ -12,8 +11,9 @@ def main():
|
||||
from httpie.status import ExitStatus
|
||||
exit_status = ExitStatus.ERROR_CTRL_C
|
||||
|
||||
sys.exit(exit_status.value)
|
||||
return exit_status.value
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
if __name__ == '__main__': # pragma: nocover
|
||||
import sys
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user