Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"One Architecture, One OS" also translates as "One Egg, One Basket".


devel / comp.lang.tcl / Re: -help parm

SubjectAuthor
* -help parmArd Vilken
+- -help parmShaun Deacon
`* -help parmSchelte
 `* -help parmShaun Deacon
  `* -help parmArd Vilken
   `* -help parmsaitology9
    `- -help parmAlex P

1
-help parm

<e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10513&group=comp.lang.tcl#10513

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:4e90:0:b0:51f:6af1:8fac with SMTP id dy16-20020ad44e90000000b0051f6af18facmr812423qvb.11.1673385947643;
Tue, 10 Jan 2023 13:25:47 -0800 (PST)
X-Received: by 2002:a05:620a:22b3:b0:702:597c:5c44 with SMTP id
p19-20020a05620a22b300b00702597c5c44mr4529030qkh.84.1673385947470; Tue, 10
Jan 2023 13:25:47 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 13:25:47 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=24.245.55.250; posting-account=DVev6goAAAAtGeJXCeXEHmRICPYYE_75
NNTP-Posting-Host: 24.245.55.250
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
Subject: -help parm
From: ardvil...@gmail.com (Ard Vilken)
Injection-Date: Tue, 10 Jan 2023 21:25:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Ard Vilken - Tue, 10 Jan 2023 21:25 UTC

Trying to allow a tk script allow a user parm of "-help". It looks like tcl has no problems with it but if using /usr/bin/wish in linux, the "-help" command line parm is immediately getting picked up by the interpreter and not by the standard user args in argv/argc and it prints some basic wish options to the terminal.

I don't want to change the "-help" option as I want the user to have a standard way of asking and it's used 50 other places.

Re: -help parm

<e86a0e53-ab1f-4555-8ac0-a084d1a928bdn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10514&group=comp.lang.tcl#10514

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:4a0f:0:b0:3a9:59bf:fe45 with SMTP id x15-20020ac84a0f000000b003a959bffe45mr2121434qtq.674.1673390138235;
Tue, 10 Jan 2023 14:35:38 -0800 (PST)
X-Received: by 2002:ac8:4f53:0:b0:3af:7d6a:6176 with SMTP id
i19-20020ac84f53000000b003af7d6a6176mr109161qtw.610.1673390137912; Tue, 10
Jan 2023 14:35:37 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 14:35:37 -0800 (PST)
In-Reply-To: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.227.41.78; posting-account=yQYMRQoAAAD2CjdIRhZwopCx50yxGe86
NNTP-Posting-Host: 50.227.41.78
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e86a0e53-ab1f-4555-8ac0-a084d1a928bdn@googlegroups.com>
Subject: Re: -help parm
From: shaun.de...@us.socionext.com (Shaun Deacon)
Injection-Date: Tue, 10 Jan 2023 22:35:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1952
 by: Shaun Deacon - Tue, 10 Jan 2023 22:35 UTC

On Tuesday, January 10, 2023 at 1:25:50 PM UTC-8, ardv...@gmail.com wrote:
> Trying to allow a tk script allow a user parm of "-help". It looks like tcl has no problems with it but if using /usr/bin/wish in linux, the "-help" command line parm is immediately getting picked up by the interpreter and not by the standard user args in argv/argc and it prints some basic wish options to the terminal.
>
> I don't want to change the "-help" option as I want the user to have a standard way of asking and it's used 50 other places.

You should insert a "--" argument just before your script arguments. This stops wish from interpreting your script arguments and passes them through to the script's argv variable.

https://www.tcl.tk/man/tcl/UserCmd/wish.html

Shaun

Re: -help parm

<nnd$1935488c$1696418f@7340a9bee6cd23d3>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10515&group=comp.lang.tcl#10515

  copy link   Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 23:41:40 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.0.2
Subject: Re: -help parm
Content-Language: nl-NL, en-US
Newsgroups: comp.lang.tcl
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
From: nos...@wanadoo.nl (Schelte)
In-Reply-To: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nnd$1935488c$1696418f@7340a9bee6cd23d3>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 15
Injection-Date: Tue, 10 Jan 2023 23:41:40 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1546
 by: Schelte - Tue, 10 Jan 2023 22:41 UTC

On 10/01/2023 22:25, Ard Vilken wrote:
>
>
> Trying to allow a tk script allow a user parm of "-help". It looks like tcl has no problems with it but if using /usr/bin/wish in linux, the "-help" command line parm is immediately getting picked up by the interpreter and not by the standard user args in argv/argc and it prints some basic wish options to the terminal.
>
> I don't want to change the "-help" option as I want the user to have a standard way of asking and it's used 50 other places.

Run your script with tclsh instead of wish. Process $argv, or copy it to
another variable. Then clear argv and do a [package require Tk].

Schelte.

Re: -help parm

<ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10516&group=comp.lang.tcl#10516

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:22c9:b0:702:5666:43aa with SMTP id o9-20020a05620a22c900b00702566643aamr2510535qki.194.1673396001896;
Tue, 10 Jan 2023 16:13:21 -0800 (PST)
X-Received: by 2002:a05:6214:307:b0:532:2358:4260 with SMTP id
i7-20020a056214030700b0053223584260mr1527224qvu.31.1673396001639; Tue, 10 Jan
2023 16:13:21 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 16:13:21 -0800 (PST)
In-Reply-To: <nnd$1935488c$1696418f@7340a9bee6cd23d3>
Injection-Info: google-groups.googlegroups.com; posting-host=50.227.41.78; posting-account=yQYMRQoAAAD2CjdIRhZwopCx50yxGe86
NNTP-Posting-Host: 50.227.41.78
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com> <nnd$1935488c$1696418f@7340a9bee6cd23d3>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>
Subject: Re: -help parm
From: shaun.de...@us.socionext.com (Shaun Deacon)
Injection-Date: Wed, 11 Jan 2023 00:13:21 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2443
 by: Shaun Deacon - Wed, 11 Jan 2023 00:13 UTC

On Tuesday, January 10, 2023 at 2:41:46 PM UTC-8, Schelte wrote:
> > I don't want to change the "-help" option as I want the user to have a standard way of asking and it's used 50 other places.
> Run your script with tclsh instead of wish. Process $argv, or copy it to
> another variable. Then clear argv and do a [package require Tk].
>
> Schelte.

Will work of course, but personally I still think it's easier to just use '--' if the OP wants to stay with wish...

Example "args.tcl" :
foreach arg $argv { puts "my arg = $arg" }

%> wish args.tcl -help
Application initialization failed: Command-specific options:
-colormap: Colormap for main window
-display: Display to use
-geometry: Initial geometry for window
-name: Name to use for application
-sync: Use synchronous mode for display server
-visual: Visual for main window
-use: Id of window in which to embed application
--: Pass all remaining arguments through to script
my arg = -help

%> wish args.tcl -- -help
my arg = -help

First invocation causes an error because '-help' is not a wish argument (so no Tk window is displayed) but runs the script (print argv contents)
Second invocation opens a Tk window, passes -help to argv, and runs the script (print argv contents)

Shaun

Re: -help parm

<2b6cd507-2116-47df-94d0-5f2c85f35f3cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10517&group=comp.lang.tcl#10517

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:ac1:b0:531:d773:fe41 with SMTP id g1-20020a0562140ac100b00531d773fe41mr935674qvi.60.1673403406680;
Tue, 10 Jan 2023 18:16:46 -0800 (PST)
X-Received: by 2002:a05:620a:209e:b0:705:bb67:b61 with SMTP id
e30-20020a05620a209e00b00705bb670b61mr730000qka.40.1673403406451; Tue, 10 Jan
2023 18:16:46 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 18:16:46 -0800 (PST)
In-Reply-To: <ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.245.55.250; posting-account=DVev6goAAAAtGeJXCeXEHmRICPYYE_75
NNTP-Posting-Host: 24.245.55.250
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
<nnd$1935488c$1696418f@7340a9bee6cd23d3> <ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b6cd507-2116-47df-94d0-5f2c85f35f3cn@googlegroups.com>
Subject: Re: -help parm
From: ardvil...@gmail.com (Ard Vilken)
Injection-Date: Wed, 11 Jan 2023 02:16:46 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1393
 by: Ard Vilken - Wed, 11 Jan 2023 02:16 UTC

I was hoping, from a user training POV not to use --help and I can take a look Schelte's approach. You were able to confirm that I wasn't doing something wrong. Thanks for the quick answers.

Re: -help parm

<tplaf5$1svf$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10518&group=comp.lang.tcl#10518

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!2FNStb0F7yksUz6/+ZFMzw.user.46.165.242.75.POSTED!not-for-mail
From: saitolo...@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: -help parm
Date: Tue, 10 Jan 2023 22:29:40 -0500
Organization: Aioe.org NNTP Server
Message-ID: <tplaf5$1svf$1@gioia.aioe.org>
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
<nnd$1935488c$1696418f@7340a9bee6cd23d3>
<ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>
<2b6cd507-2116-47df-94d0-5f2c85f35f3cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="62447"; posting-host="2FNStb0F7yksUz6/+ZFMzw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.2
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: saitology9 - Wed, 11 Jan 2023 03:29 UTC

On 1/10/2023 9:16 PM, Ard Vilken wrote:
> I was hoping, from a user training POV not to use --help and I can take a look Schelte's approach. You were able to confirm that I wasn't doing something wrong. Thanks for the quick answers.

The proper solution here is to use "--" before listing your options for
your own script.

Using "--" as an option itself to prevent the command line from
consuming other options is a pretty standard practice. Some Tcl
commands like "switch" also use it to avoid interpreting certain data
items (ie. those starting with a dash) as potential command options. It
is a safe bet to say that anyone using Linux knows about this convention
too.

Also keep in mind that "-help" is a common option across many
commands/programs. It was accepted and gave you an answer (albeit a
wrong one). Otherwise, you could have gotten an error message, if for
example, it was named "-displayhelp".

Re: -help parm

<6c7896be-0c4d-4b03-8ce0-6292e5c9b8a4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10519&group=comp.lang.tcl#10519

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ae9:e20f:0:b0:702:16ea:dfab with SMTP id c15-20020ae9e20f000000b0070216eadfabmr2922088qkc.759.1673418459383;
Tue, 10 Jan 2023 22:27:39 -0800 (PST)
X-Received: by 2002:ac8:7210:0:b0:3a5:2751:ce81 with SMTP id
a16-20020ac87210000000b003a52751ce81mr3771552qtp.322.1673418459225; Tue, 10
Jan 2023 22:27:39 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 10 Jan 2023 22:27:39 -0800 (PST)
In-Reply-To: <tplaf5$1svf$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=85.249.21.171; posting-account=VcikiQoAAAB8qn43rZQzxdhWq0g1FGMy
NNTP-Posting-Host: 85.249.21.171
References: <e2f193c8-aa5d-4706-a305-7fb822c006een@googlegroups.com>
<nnd$1935488c$1696418f@7340a9bee6cd23d3> <ca2b2304-c239-4aa3-b639-54b7b960fe4dn@googlegroups.com>
<2b6cd507-2116-47df-94d0-5f2c85f35f3cn@googlegroups.com> <tplaf5$1svf$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c7896be-0c4d-4b03-8ce0-6292e5c9b8a4n@googlegroups.com>
Subject: Re: -help parm
From: aplsim...@gmail.com (Alex P)
Injection-Date: Wed, 11 Jan 2023 06:27:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1709
 by: Alex P - Wed, 11 Jan 2023 06:27 UTC

Schelte is right. You should also remember about ::argc variable that is length of ::argv and must be modified along with ::argv, e.g. this way:

puts "$::argc - $::argv" ;# to test and drop
set i [lsearch $::argv -help]
if {$i>-1} {
puts {
Its' my help:
Do this and that...
}
set ::argv [lreplace $::argv $i $i]
set ::argc [llength $::argv]
} unset i
package require Tk
puts "$::argc - $::argv" ;# to test and drop


devel / comp.lang.tcl / Re: -help parm

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor