Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

What is the proper way to create hyphen arguments in TCL?

What is the proper way to create hyphen arguments in TCL?

What is the proper way to create hyphen arguments in TCL?

OK lets say I want to be able to call a function like this:

myfunc -param_action_a param_1 param_2 param_3 -param_action_b param_1 -no_param_action_c -no_param_action_d

Now there might be complex interdependencies because:
1. Some actions are compulsory to be specified, maybe one of many or all of many need to be specified when myfunc is called
2. Some actions are optional in any case and myfunc can always be successful without them being specified
3. Some actions are optional but can only be specified when certain other option exists but not otherwise
4. Some actions cannot be specified when certain others are specified and doing so leads to error

5. Some actions need parameters
6. Some actions do not need parameters
7. Some actions have default parameters maybe some or all
8. Some actions have no default parameters
9. The parameters must be validated to ensure that their value is not invalid

Now I have found that there exists these things:
1. parse_args
2. argparse
3. cmdline
4. Just hack a way using arrays and lists

Now I cannot for the life of me figure out the proper way to do this which can satisfy all the above requirements. Only a "proper" solution can do that. I do not have a lot of time to compare and contrast the 4 methods above. Does TCL have a proper solution to the problem I have described? Maybe someone from the TCL creators group can guide me here.

RE: What is the proper way to create hyphen arguments in TCL?

Seems like you just need to pass a list to myfunc. Then you can parse the list within the procedure.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close