bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: declare -F incorrect line number


From: Chet Ramey
Subject: Re: declare -F incorrect line number
Date: Wed, 5 Oct 2022 15:36:55 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

On 10/5/22 3:32 PM, Daniel Castro wrote:
In this case I’m not doing anything too fancy: my use case is I have a main project script where I declare functions that can get executed independently with some prefix: e.g. ``x.build()``, ``x.test()`` so I can call ``myscript test`` or ``myscript build`` by parsing all x.* functions, and sometimes I have functions within them just for clarity since they’re just some abstraction for that particular function logic.

I parse these x function's comments as well to show in ``--help`` and therefore happened to notice the bug. The workaround for me is to simply move them outside the top level function, but I don't know if it would get in the way for some people doing more convoluted stuff with functions.

That's why I was asking -- there's no such thing as a local function, but I
can see wanting to declare a set of functions only if the `main' function
gets declared as an abstraction technique. Other than that, there's no
advantage.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]