{"id":6943,"date":"2023-01-02T10:16:05","date_gmt":"2023-01-02T10:16:05","guid":{"rendered":"https:\/\/davelevy.info\/wiki\/?p=6943"},"modified":"2024-03-12T16:49:43","modified_gmt":"2024-03-12T16:49:43","slug":"tcl-argument-processing","status":"publish","type":"post","link":"https:\/\/davelevy.info\/wiki\/tcl-argument-processing\/","title":{"rendered":"TCL Argument processing"},"content":{"rendered":"<p>You&#8217;d think TCL argument processing has been done and would be easy to find. But not for me. Here are my notes,<br \/>\n<!--more--><\/p>\n<ol>\n<li>An article called <a href=\"https:\/\/subscription.packtpub.com\/book\/networking-&amp;-servers\/9781849512985\/1\/ch01lvl1sec10\/command-line-arguments\">command line arguments<\/a>, it has some sample TCL code accessing the $argv object<\/li>\n<li>At tcl-lang.org, <a href=\"https:\/\/wiki.tcl-lang.org\/page\/Argument+Parsing%2C+a+discussion\">Argument Parsing: a discussion<\/a>\u00a0and an extended command called <a href=\"https:\/\/wiki.tcl-lang.org\/page\/argparse\">argparse<\/a>, but I get an invalid command name when using one of their examples. Is <code>argparse<\/code> a python sub-routine?<\/li>\n<li>How to <a href=\"https:\/\/rosettacode.org\/wiki\/Parse_command-line_arguments#Tcl\">parse_command-line_arguments in Tcl<\/a>\u00a0from rosettacode.org<\/li>\n<li>and good old stack overflow <a href=\"https:\/\/stackoverflow.com\/questions\/24341141\/package-for-parsing-argument-in-tcl\">package-for-parsing-argument-in-tcl<\/a>, with several examples. I have hit a problem and <a href=\"https:\/\/askubuntu.com\/questions\/1448346\/how-to-implement-a-tcl-package\">asked for help<\/a> at askubuntu.<\/li>\n<\/ol>\n<p>If it gets too hard I can always parse the command line in shell, which I did, see my <a href=\"https:\/\/github.com\/dfl1955\/ubuntu-tools\/blob\/master\/tools\/smsg_parser.tcl\">smsg parser<\/a>, as ever with TCL, I am sure my code could could be less verbose. I <a href=\"https:\/\/www2.lib.uchicago.edu\/keith\/tcl-course\/topics\/arrays.html\">looked<\/a> at associative arrays and <a href=\"https:\/\/stackoverflow.com\/questions\/25083821\/how-to-print-the-contents-of-an-array-in-tcl\">displaying<\/a> them. I revised <a href=\"https:\/\/www.tcl.tk\/man\/tcl\/TclCmd\/proc.html\">some procedure stuff<\/a>, and <a href=\"https:\/\/www.tcl.tk\/man\/tcl8.0\/TclCmd\/string.html#M8\">string manipulation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You&#8217;d think TCL argument processing has been done and would be easy to find. But not for me. Here are my notes,<\/p>\n","protected":false},"author":1,"featured_media":3212,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_share_on_mastodon":"0"},"categories":[3],"tags":[36,260,911],"class_list":["post-6943","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-programming","tag-tcltk","tag-technology"],"share_on_mastodon":{"url":"","error":""},"jetpack_featured_media_url":"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2017\/07\/tcl-tk-w650.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/6943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/comments?post=6943"}],"version-history":[{"count":2,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/6943\/revisions"}],"predecessor-version":[{"id":10681,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/6943\/revisions\/10681"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media\/3212"}],"wp:attachment":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media?parent=6943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/categories?post=6943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/tags?post=6943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}