Feature request: The rest of arguments syntax: `%An*`

Here you can propose new features, make suggestions etc.

Moderators: petermad, Stefan2, white, Hacker

andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Currently there is no way to use like this:

Code: Select all

em_blabla pos1 pos2 flag1 flag2 ... flagN

Code: Select all

[em_blabla]
cmd=...
param=... %A3* -- %A1 %A2
If positional parameters always has a fixed set. When flag parameters basically a variable set.

So if you use it in commands, then you have to swap the order to use a variable parameter set at the command line end.

But there is no way to use `the rest of %A` syntax in Total Commander.
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

Considering my suggestion, I propose to expand the capabilities:

%An+, %Sn+, %Rn+ — parameters starting from n.
%An+m, %Sn+m, %Rn+m — parameters from n to m.
%An-, %Sn-, %Rn- — the last n parameters.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16563
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *petermad »

%An+, %Sn+, %Rn+ — parameters starting from n.
%An+m, %Sn+m, %Rn+m — parameters from n to m.
%An-, %Sn-, %Rn- — the last n parameters.
Support++
License #524 1994
Danish TC Translator
TC 11.56 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1404a
TC 3.62b2 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Galizza
Senior Member
Senior Member
Posts: 245
Joined: 2018-09-07, 05:21 UTC
Location: Galiza (Spain)

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Galizza »

Support+
 Looking through a glass onion
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-20, 02:41 UTC Considering my suggestion, I propose to expand the capabilities:

%An+, %Sn+, %Rn+ — parameters starting from n.
%An+m, %Sn+m, %Rn+m — parameters from n to m.
%An-, %Sn-, %Rn- — the last n parameters.
May be extend by using open/close characters like in the Unix shell?

String slice:

%A:~n, %A:~n,m, %A:~n,-m, %A:~-n — stringize %A and then slice a substring.
%A1:~n, %A1:~n,m, %A1:~n,-m, %A1:~-n — stringize %A1 and then slice a substring.

Array slice:

%{A[n:]}, %{A[n:m]}, %{A[n:-m]}, %{A[:n]}, %{A[:-n]} — slice an array.

This will prevent misuse, when the followed character does not actually start a range selection sequence.

%{A}:.., %{A1}:.. - %A expanded as is without slicing.
%A[n:], %A[n:m], %A[n:-m], %A[:n], %A[:-n], %A[... — %A expanded as %A without slicing.
%%A, %%{ - raw strings.
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

We already have %B-, %B-n, %B+ and %B+n, but only one component is extracted there. For the group, it makes sense to indicate the sign after n.
However, the syntax is not as important as the implementation itself. I think the author will figure out the best way.
Overquoting is evil! 👎
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-21, 06:53 UTC We already have %B-, %B-n, %B+ and %B+n, but only one component is extracted there. For the group, it makes sense to indicate the sign after n.
However, the syntax is not as important as the implementation itself. I think the author will figure out the best way.
These does slice for file paths. If you try to continue use it, then it will bring much more problems.
When mine variant does fix it too.

%B here expands as is:

Code: Select all

%{B}-, %{B}-n, %{B}+, %{B}+n
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

andry81 wrote: 2026-01-21, 07:06 UTCIf you try to continue use it, then it will bring much more problems.
Why should I try? I already use it successfully as the author of the suggestion.
andry81 wrote: 2026-01-21, 07:06 UTC%B here expands as is:
I don't understand what you mean by that.
Overquoting is evil! 👎
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-21, 07:32 UTC
andry81 wrote: 2026-01-21, 07:06 UTC%B here expands as is:
I don't understand what you mean by that.
B=a/b/c

Code: Select all

%{B}-123
Expands to:

Code: Select all

a/b/c-123

Code: Select all

%B-123
Expands to:

Code: Select all

a23
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

It depends on the working directory.
If "C:\1\2\3\4\5\6\7\8\9\10\11\" is open, %B-123 will return 1023. 23 is excluded because 9 is the upper limit.
Overquoting is evil! 👎
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-21, 17:12 UTC It depends on the working directory.
If "C:\1\2\3\4\5\6\7\8\9\10\11\" is open, %B-123 will return 1023. 23 is excluded because 9 is the upper limit.
My example show how to escape the excessive expansion.
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

What, in your opinion, is an excessive expansion in this case?
Overquoting is evil! 👎
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-22, 16:12 UTC What, in your opinion, is an excessive expansion in this case?
Consumed characters because of accident of an expansion.
Fla$her
Power Member
Power Member
Posts: 3330
Joined: 2020-01-18, 04:03 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *Fla$her »

I don't quite understand your wording. Could you highlight these characters in the example?
Overquoting is evil! 👎
andry81
Member
Member
Posts: 151
Joined: 2018-11-22, 19:17 UTC

Re: Feature request: The rest of arguments syntax: `%An*`

Post by *andry81 »

Fla$her wrote: 2026-01-22, 18:42 UTC I don't quite understand your wording. Could you highlight these characters in the example?
Do you understand that the characters after a `%B` sequence can be a legit path or a string? A user might will want to escape these and could not do it.

For example, in a particular case you can do it:

Code: Select all

cmd=cmd.exe /k
params=echo %B^-00
But can not in a generic case.
Post Reply