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

Output name of the program for --version #32844

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tansy
Copy link

@tansy tansy commented Jul 10, 2024

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • [ x] I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • [ x ] Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Explanation of your pull request in arbitrary form goes here. Please make sure the description explains the purpose and effect of your pull request and is worded well enough to be understood. Provide as much context and examples as possible.


'The GNU standard --version option should direct the program to print information about its name, version' So added a name of program to version displaye along with shotr option `-V'.

$ python youtube-dl.py -V
youtube-dl 2024.07.08

'The GNU standard --version option should direct the program to print information about its name, version'
So added a name of program to version displaye along with shotr option \`-V'.
@dirkf
Copy link
Contributor

dirkf commented Jul 10, 2024

Someone should have pointed this out ca. 2010, before people wrote (I expect) lots of scripts that parse the output of the --version option as yyyy.mm.dd. Can I suggest, say,

youtubedl() {
    case "$1" in
    -V|--version) printf "youtube-dl " ;;
    esac
    command youtube-dl "$@"
}
alias youtube-dl=youtubedl

Or something similar in a shell other than POSIX.

@tansy
Copy link
Author

tansy commented Jul 10, 2024

Someone should have pointed this out ca. 2010

Ca. 2010 i didn't know about this program. I'm sure that 95% of present users didn't know it either.

before people wrote (I expect) lots of scripts

I'm certain there ate lots of Scots that use ytdl

that parse the output of the --version option

But none of them, ok 99.(9)% of them don't paste version number.
What for?

as yyyy.mm.dd

As above. I bet here and now that no one parses version number.
What for?
The only reason to check version is to report a bug. But maybe that's just me.

Can I suggest, say,

Sure.

alias youtube-dl=youtubedl

youtubedl "$@" works better.

Or something similar in a shell other than POSIX.

In non POSIX is not posixble.

--

I will leave it, if I can, and wait for objections or consent.

@dirkf
Copy link
Contributor

dirkf commented Jul 11, 2024

Fair enough. There are other ways in which the command-line syntax doesn't fully behave as GNU-ishly as one would expect, basically because of the Python command line parsing module used.

Maybe someone will find a way to fix this and then we could have a --gnuishly-correct option together with which --version could include the program name and possibly other information such as licensing and versions of dependencies (eg ffmpeg).

The same issue still applies in yt-dlp:

$ ~/Downloads/yt-dlp-2024.07.02 --version
2024.07.02
$ 

@tansy
Copy link
Author

tansy commented Jul 11, 2024

I try to reason it this way - it makes sense to announce program name when asking for a version. Cause version of what? It's especially true here, where date is used as a version. What do you think when you see this thing: `2024-01-01', cause I see a date. What that date refers to is not known.
What do you think when you see this: `gzip 1.13'? First think that comes to a mind is gzip, version 1.13.
On the other hand, I referred to GNU coding standards as they are simple and concise. Other programs include all kinds od unnecessary rap to their version print. So this was the simplest and most logical of all.

The same issue still applies in yt-dlp

Anecdotal evidence. Hundreds of other programs do include their name in version print.

Maybe someone will find a way to fix this and then we could have a --gnuishly-correct option together with which --version could include the program name and possibly other information such as licensing and versions of dependencies (eg ffmpeg).

I quoted GNU as the option is `--version' brings to mind GNU coding standards rather than any other 'code of conduct'.

If it was put in a function that would do it, would it be better?
I can do it so it would print `program-name version' in basic option and, in verbose, it would add some more stuff. Maybe like this:

$ youtube-dl --version
youtube-dl 2011-11-11

$ youtube-dl --version --verbose
youtube-dl 2011-11-11
Copyright/left (C) 2011
This is free and unencumbered software released into the public domain.
For more information, please refer to <http://unlicense.org/>
There is NO WARRANTY, to the extent permitted by law.

and in help:

    -V, --version                        Print program version and exit. Verbose output prints also licence.

Where shall I put this function, in `version.py' or `utils.py' or somewhere else?
And what is `action='store_true''? `dest='update_self'' is, as I guess, the function to call.

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.

2 participants