Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect the program name when python -m was executed #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dukecat0
Copy link

@dukecat0 dukecat0 commented Dec 17, 2022

Closes #76

Old behaviour:

SYNOPSIS
    __main__.py ARGS

New behaviour:

SYNOPSIS
    '/usr/bin/python -m sample' ARGS

@@ -281,6 +282,45 @@ def _PrintResult(component_trace, verbose=False, serialize=None):
Display(output, out=sys.stdout)


def _GetProgName(name, main=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current PR I don't think the main arg is passed anywhere (other than the test). Is a file missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only passed during testing.

@dbieber
Copy link
Member

dbieber commented Dec 20, 2022

Good idea! Thanks for submitting 👍


Args:
name: Optional. The name of the command as entered at the command line.
main: Optional. This should only be passed during testing.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use package name when __main__.py is used
2 participants