Skip to content

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

Display(output, out=sys.stdout)


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

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
Collaborator

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 :)

@dbieber
Copy link
Collaborator

dbieber commented Sep 20, 2024

The new behavior doesn't look quite like what we want:

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

Instead, we'd prefer the following, right?

SYNOPSIS
    /usr/bin/python -m sample ARGS

@dukecat0
Copy link
Author

It looks like the quotes come from here:

return ' '.join(self._Quote(arg) for arg in args)

I think the reason is that there are spaces inside self.name, i.e. /usr/bin/python -m sample. Any opinions on how should we deal with this case?

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