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

Function request #4

Open
ougx opened this issue Mar 17, 2023 · 2 comments
Open

Function request #4

ougx opened this issue Mar 17, 2023 · 2 comments

Comments

@ougx
Copy link

ougx commented Mar 17, 2023

Hi this is a great addon for Fortran programmer. I am hoping it can be even further enhanced/

  1. allow multiple arguments after a switch:
    myapp --range 1.0 2.0 or myapp -r 1.0 2.0
    This can be achieved by adding another parameter in the option_s struct such as nopts. Default can be nopts == 0 for no argument.
  2. allow repeating switch:
    myapp --add file1 --add file2 and provide the occurrence of add

Are these implemented? If not, can you implement them? If you do not have time, I can help implement these through a pull request.

Thank you so much!

@ougx
Copy link
Author

ougx commented Mar 17, 2023

some thing very interesting:

using ifort on windows, it will stop after paring the first option using the example

however, it runs fine, if you change the sample by calling the function outside the case selection. gfortran does not have this issue.

    do
        a = getopt("ab:h", opts)
        select case(a)
            case(char(0)) ! When all options are processed
                exit
            case("a")
                print*, "option alpha/a"
            case("b")
                print*, "option beta/b=",  trim(optarg) ! "trim" is quite useful to avoid trailing blanks
            case("h")
                print*, "help-screen"
        end select
    end do

@haniibrahim
Copy link
Owner

Are these implemented? If not, can you implement them?

No, not at the moment.

"I can help implement these through a pull request."

Feel free to do so. Thanks, Hani

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

No branches or pull requests

2 participants