Closed ptth222 closed 1 year ago
Just include both versions of the option in the docstring. It is the safest and easiest.
Just indicate in the description that the underscore option is identical to the dashed option and indicate it will be deprecated in the future.
On Thu, Jul 6, 2023 at 10:24 AM ptth222 @.***> wrote:
I have ran into more of an issue than I expected trying to implement this. Basically, since docopt is used for the interface the only way to allow both the underscore version and the hyphen version of an option is to add them into the usage. There is no concept of aliases or hidden options to docopt. The interface would have to look like:
Usage: academic_tracker author_search
[--test --prev_pub= --no_GoogleScholar --no-GoogleScholar --no_ORCID --no-ORCID --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent] academic_tracker reference_search [--test --prev_pub= --prev-pub= --PMID_reference --PMID-reference --MEDLINE_reference --MEDLINE-reference --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent] academic_tracker find_ORCID [--verbose --silent] academic_tracker find_Google_Scholar [--verbose --silent] academic_tracker add_authors [--verbose --silent] academic_tracker tokenize_reference [--MEDLINE_reference --MEDLINE-reference --verbose --silent] academic_tracker gen_reports_and_emails_auth [--test --verbose --silent] academic_tracker gen_reports_and_emails_ref [--test --prev_pub= --prev-pub= --MEDLINE_reference --MEDLINE-reference --verbose --silent] Options: -h --help Show this screen. -v --version Show version. --verbose Print hidden error messages. --silent Do not print anything to the screen. --test Generate pubs and email texts, but do not send emails. --prev_pub=
Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. --prev-pub= Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. Reference Type Options: --PMID_reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. --PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. --MEDLINE_reference Indicates that the reference_file is a MEDLINE file. --MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
Search Options: --no_GoogleScholar Don't search Google Scholar. --no-GoogleScholar Don't search Google Scholar. --no_ORCID Don't search ORCID. --no-ORCID Don't search ORCID. --no_Crossref Don't search Crossref. --no-Crossref Don't search Crossref. --no_PubMed Don't search PubMed. --no-PubMed Don't search PubMed.
It looks like I could overwrite docopt's function and get around this without too much difficulty, but I don't really like doing that if I don't have to because it's fragile to breaking if the underlying package changes. docopt hasn't changed since 2014 though, so it is probably one of the safest packages to do this with. What do you think?
— Reply to this email directly, view it on GitHub https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEP7B2O3VMIQ6IUBD2PPW3XO3DCRANCNFSM6AAAAAA2AQQYTE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Email: @. (work) @. (personal) Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax) Web: http://bioinformatics.cesb.uky.edu/ Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093
Link to issue: https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2 Okay, so I changed it over to look like this:
Usage:
academic_tracker author_search <config_json_file> [--test --prev_pub=<file-path> --prev-pub=<file-path> --no_GoogleScholar --no-GoogleScholar --no_ORCID --no-ORCID --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent]
academic_tracker reference_search <config_json_file> <references_file_or_URL> [--test --prev_pub=<file-path> --prev-pub=<file-path> --PMID_reference --PMID-reference --MEDLINE_reference --MEDLINE-reference --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent]
academic_tracker find_ORCID <config_json_file> [--verbose --silent]
academic_tracker find_Google_Scholar <config_json_file> [--verbose --silent]
academic_tracker add_authors <config_json_file> <authors_file> [--verbose --silent]
academic_tracker tokenize_reference <references_file_or_URL> [--MEDLINE_reference --MEDLINE-reference --verbose --silent]
academic_tracker gen_reports_and_emails_auth <config_json_file> <publication_json_file> [--test --verbose --silent]
academic_tracker gen_reports_and_emails_ref <config_json_file> <references_file_or_URL> <publication_json_file> [--test --prev_pub=<file-path> --prev-pub=<file-path> --MEDLINE_reference --MEDLINE-reference --verbose --silent]
Options:
-h --help Show this screen.
-v --version Show version.
--verbose Print hidden error messages.
--silent Do not print anything to the screen.
--test Generate pubs and email texts, but do not send emails.
--prev_pub=<file-path> Filepath to json or csv with publication ids to ignore.
Enter "ignore" for the <file_path> to not look for previous publications.json files in tracker directories.
Deprecated. Use --prev-pub instead.
--prev-pub=<file-path> Filepath to json or csv with publication ids to ignore.
Enter "ignore" for the <file_path> to not look for previous publications.json files in tracker directories.
Reference Type Options:
--PMID_reference Indicates that the reference_file is a PMID file and only PubMed info will be returned.
Deprecated. Use --PMID-reference instead.
--PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned.
--MEDLINE_reference Indicates that the reference_file is a MEDLINE file.
Deprecated. Use --MEDLINE-reference instead.
--MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
Search Options:
--no_GoogleScholar Don't search Google Scholar.
Deprecated. Use --no-GoogleScholar instead.
--no-GoogleScholar Don't search Google Scholar.
--no_ORCID Don't search ORCID.
Deprecated. Use --no-ORCID instead.
--no-ORCID Don't search ORCID.
--no_Crossref Don't search Crossref.
Deprecated. Use --no-Crossref instead.
--no-Crossref Don't search Crossref.
--no_PubMed Don't search PubMed.
Deprecated. Use --no-PubMed instead.
--no-PubMed Don't search PubMed.
Does this look okay to you? Also the command names have underscores, so should we alias those too?
I am not sure about the command names. By the same logic, they should be changed as well. However, there is no convention I know of on command names.
Let's leave the command names with underscores for now, unless you find a convention that states otherwise.
On Fri, Jul 7, 2023 at 11:07 AM ptth222 @.***> wrote:
Link to issue: #2 https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2 Okay, so I changed it over to look like this:
Usage: academic_tracker author_search
[--test --prev_pub= --prev-pub= --no_GoogleScholar --no-GoogleScholar --no_ORCID --no-ORCID --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent] academic_tracker reference_search [--test --prev_pub= --prev-pub= --PMID_reference --PMID-reference --MEDLINE_reference --MEDLINE-reference --no_Crossref --no-Crossref --no_PubMed --no-PubMed --verbose --silent] academic_tracker find_ORCID [--verbose --silent] academic_tracker find_Google_Scholar [--verbose --silent] academic_tracker add_authors [--verbose --silent] academic_tracker tokenize_reference [--MEDLINE_reference --MEDLINE-reference --verbose --silent] academic_tracker gen_reports_and_emails_auth [--test --verbose --silent] academic_tracker gen_reports_and_emails_ref [--test --prev_pub= --prev-pub= --MEDLINE_reference --MEDLINE-reference --verbose --silent] Options: -h --help Show this screen. -v --version Show version. --verbose Print hidden error messages. --silent Do not print anything to the screen. --test Generate pubs and email texts, but do not send emails. --prev_pub=
Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. Deprecated. Use --prev-pub instead. --prev-pub= Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. Reference Type Options: --PMID_reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. Deprecated. Use --PMID-reference instead. --PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. --MEDLINE_reference Indicates that the reference_file is a MEDLINE file. Deprecated. Use --MEDLINE-reference instead. --MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
Search Options: --no_GoogleScholar Don't search Google Scholar. Deprecated. Use --no-GoogleScholar instead. --no-GoogleScholar Don't search Google Scholar. --no_ORCID Don't search ORCID. Deprecated. Use --no-ORCID instead. --no-ORCID Don't search ORCID. --no_Crossref Don't search Crossref. Deprecated. Use --no-Crossref instead. --no-Crossref Don't search Crossref. --no_PubMed Don't search PubMed. Deprecated. Use --no-PubMed instead. --no-PubMed Don't search PubMed.
Does this look okay to you? Also the command names have underscores, so should we alias those too?
— Reply to this email directly, view it on GitHub https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2#issuecomment-1625553951, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEP7B7MUIWAUHXUL3F2LLTXPAQZXANCNFSM6AAAAAA2AQQYTE . You are receiving this because you commented.Message ID: @.***>
Email: @. (work) @. (personal) Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax) Web: http://bioinformatics.cesb.uky.edu/ Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093
https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2
Okay. The rest looks okay though? As far as indicating what is deprecated and the order. I couldn't decide if I should list all the hyphen versions and then the underscores, or do what I did which was do underscore then hyphen for each option.
Also I just reworked the options to be on multiple lines:
Usage:
academic_tracker author_search <config_json_file> [--test]
[--prev_pub=<file-path> --prev-pub=<file-path>]
[--no_GoogleScholar --no-GoogleScholar]
[--no_ORCID --no-ORCID]
[--no_Crossref --no-Crossref]
[--no_PubMed --no-PubMed]
[--verbose --silent]
academic_tracker reference_search <config_json_file> <references_file_or_URL> [--test]
[--prev_pub=<file-path> --prev-pub=<file-path>]
[--PMID_reference --PMID-reference]
[--MEDLINE_reference --MEDLINE-reference]
[--no_Crossref --no-Crossref]
[--no_PubMed --no-PubMed]
[--verbose --silent]
academic_tracker find_ORCID <config_json_file> [--verbose --silent]
academic_tracker find_Google_Scholar <config_json_file> [--verbose --silent]
academic_tracker add_authors <config_json_file> <authors_file> [--verbose --silent]
academic_tracker tokenize_reference <references_file_or_URL> [--MEDLINE_reference --MEDLINE-reference]
[--verbose --silent]
academic_tracker gen_reports_and_emails_auth <config_json_file> <publication_json_file> [--test --verbose --silent]
academic_tracker gen_reports_and_emails_ref <config_json_file> <references_file_or_URL> <publication_json_file> [--test]
[--prev_pub=<file-path> --prev-pub=<file-path>]
[--MEDLINE_reference --MEDLINE-reference]
[--verbose --silent]
Options:
-h --help Show this screen.
-v --version Show version.
--verbose Print hidden error messages.
--silent Do not print anything to the screen.
--test Generate pubs and email texts, but do not send emails.
--prev_pub=<file-path> Filepath to json or csv with publication ids to ignore.
Enter "ignore" for the <file_path> to not look for previous publications.json files in tracker directories.
Deprecated. Use --prev-pub instead.
--prev-pub=<file-path> Filepath to json or csv with publication ids to ignore.
Enter "ignore" for the <file_path> to not look for previous publications.json files in tracker directories.
Reference Type Options:
--PMID_reference Indicates that the reference_file is a PMID file and only PubMed info will be returned.
Deprecated. Use --PMID-reference instead.
--PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned.
--MEDLINE_reference Indicates that the reference_file is a MEDLINE file.
Deprecated. Use --MEDLINE-reference instead.
--MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
Search Options:
--no_GoogleScholar Don't search Google Scholar.
Deprecated. Use --no-GoogleScholar instead.
--no-GoogleScholar Don't search Google Scholar.
--no_ORCID Don't search ORCID.
Deprecated. Use --no-ORCID instead.
--no-ORCID Don't search ORCID.
--no_Crossref Don't search Crossref.
Deprecated. Use --no-Crossref instead.
--no-Crossref Don't search Crossref.
--no_PubMed Don't search PubMed.
Deprecated. Use --no-PubMed instead.
--no-PubMed Don't search PubMed.
To make it more concise, I would list the dash version first with description and then the underscore version right after, but only with the Deprecated... description.
On Fri, Jul 7, 2023 at 11:26 AM ptth222 @.***> wrote:
2 https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2
Okay. The rest looks okay though? As far as indicating what is deprecated and the order. I couldn't decide if I should list all the hyphen versions and then the underscores, or do what I did which was do underscore then hyphen for each option.
Also I just reworked the options to be on multiple lines:
Usage: academic_tracker author_search
[--test] [--prev_pub= --prev-pub= ] [--no_GoogleScholar --no-GoogleScholar] [--no_ORCID --no-ORCID] [--no_Crossref --no-Crossref] [--no_PubMed --no-PubMed] [--verbose --silent] academic_tracker reference_search [--test] [--prev_pub= --prev-pub= ] [--PMID_reference --PMID-reference] [--MEDLINE_reference --MEDLINE-reference] [--no_Crossref --no-Crossref] [--no_PubMed --no-PubMed] [--verbose --silent] academic_tracker find_ORCID [--verbose --silent] academic_tracker find_Google_Scholar [--verbose --silent] academic_tracker add_authors [--verbose --silent] academic_tracker tokenize_reference [--MEDLINE_reference --MEDLINE-reference] [--verbose --silent] academic_tracker gen_reports_and_emails_auth [--test --verbose --silent] academic_tracker gen_reports_and_emails_ref [--test] [--prev_pub= --prev-pub= ] [--MEDLINE_reference --MEDLINE-reference] [--verbose --silent] Options: -h --help Show this screen. -v --version Show version. --verbose Print hidden error messages. --silent Do not print anything to the screen. --test Generate pubs and email texts, but do not send emails. --prev_pub=
Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. Deprecated. Use --prev-pub instead. --prev-pub= Filepath to json or csv with publication ids to ignore. Enter "ignore" for the to not look for previous publications.json files in tracker directories. Reference Type Options: --PMID_reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. Deprecated. Use --PMID-reference instead. --PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned. --MEDLINE_reference Indicates that the reference_file is a MEDLINE file. Deprecated. Use --MEDLINE-reference instead. --MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
Search Options: --no_GoogleScholar Don't search Google Scholar. Deprecated. Use --no-GoogleScholar instead. --no-GoogleScholar Don't search Google Scholar. --no_ORCID Don't search ORCID. Deprecated. Use --no-ORCID instead. --no-ORCID Don't search ORCID. --no_Crossref Don't search Crossref. Deprecated. Use --no-Crossref instead. --no-Crossref Don't search Crossref. --no_PubMed Don't search PubMed. Deprecated. Use --no-PubMed instead. --no-PubMed Don't search PubMed.
— Reply to this email directly, view it on GitHub https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2#issuecomment-1625580396, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEP7B2C2LZKDU5SKH6AGG3XPATBRANCNFSM6AAAAAA2AQQYTE . You are receiving this because you commented.Message ID: @.***>
Email: @. (work) @. (personal) Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax) Web: http://bioinformatics.cesb.uky.edu/ Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093
https://github.com/MoseleyBioinformaticsLab/academic_tracker/issues/2 I have made those changes:
Usage:
academic_tracker author_search <config_json_file> [--test]
[--prev_pub=<file-path> --prev-pub=<file-path>]
[--no-GoogleScholar --no_GoogleScholar]
[--no-ORCID --no_ORCID]
[--no-Crossref --no_Crossref]
[--no-PubMed --no_PubMed]
[--verbose --silent]
academic_tracker reference_search <config_json_file> <references_file_or_URL> [--test]
[--prev-pub=<file-path> --prev_pub=<file-path>]
[--PMID-reference --PMID_reference]
[--MEDLINE-reference --MEDLINE_reference]
[--no-Crossref --no_Crossref]
[--no-PubMed --no_PubMed]
[--verbose --silent]
academic_tracker find_ORCID <config_json_file> [--verbose --silent]
academic_tracker find_Google_Scholar <config_json_file> [--verbose --silent]
academic_tracker add_authors <config_json_file> <authors_file> [--verbose --silent]
academic_tracker tokenize_reference <references_file_or_URL> [--MEDLINE-reference --MEDLINE_reference]
[--verbose --silent]
academic_tracker gen_reports_and_emails_auth <config_json_file> <publication_json_file> [--test --verbose --silent]
academic_tracker gen_reports_and_emails_ref <config_json_file> <references_file_or_URL> <publication_json_file> [--test]
[--prev-pub=<file-path> --prev_pub=<file-path>]
[--MEDLINE-reference --MEDLINE_reference]
[--verbose --silent]
Options:
-h --help Show this screen.
-v --version Show version.
--verbose Print hidden error messages.
--silent Do not print anything to the screen.
--test Generate pubs and email texts, but do not send emails.
--prev-pub=<file-path> Filepath to json or csv with publication ids to ignore.
Enter "ignore" for the <file_path> to not look for previous publications.json files in tracker directories.
--prev_pub=<file-path> Deprecated. Use --prev-pub instead.
Reference Type Options:
--PMID-reference Indicates that the reference_file is a PMID file and only PubMed info will be returned.
--PMID_reference Deprecated. Use --PMID-reference instead.
--MEDLINE-reference Indicates that the reference_file is a MEDLINE file.
--MEDLINE_reference Deprecated. Use --MEDLINE-reference instead.
Search Options:
--no-GoogleScholar Don't search Google Scholar.
--no_GoogleScholar Deprecated. Use --no-GoogleScholar instead.
--no-ORCID Don't search ORCID.
--no_ORCID Deprecated. Use --no-ORCID instead.
--no-Crossref Don't search Crossref.
--no_Crossref Deprecated. Use --no-Crossref instead.
--no-PubMed Don't search PubMed.
--no_PubMed Deprecated. Use --no-PubMed instead.
Version 1.0.6 on PyPi has this.
I have ran into more of an issue than I expected trying to implement this. Basically, since docopt is used for the interface the only way to allow both the underscore version and the hyphen version of an option is to add them into the usage. There is no concept of aliases or hidden options to docopt. The interface would have to look like:
It looks like I could overwrite docopt's function and get around this without too much difficulty, but I don't really like doing that if I don't have to because it's fragile to breaking if the underlying package changes. docopt hasn't changed since 2014 though, so it is probably one of the safest packages to do this with. What do you think?