insect icon indicating copy to clipboard operation
insect copied to clipboard

Command to list user defined variables

Open sandorex opened this issue 3 years ago • 9 comments

sandorex avatar Aug 19 '20 14:08 sandorex

You should see the user-defined variables when typing list or ls.

sharkdp avatar Aug 19 '20 18:08 sharkdp

Yes but i thought a feature to list only user-defined variable would be helpful

sandorex avatar Aug 20 '20 14:08 sandorex

Ok - sounds like a reasonable request.

sharkdp avatar Sep 01 '20 21:09 sharkdp

I made an attempt to implement this feature, what keyword could be used for this command?

l-nz avatar Sep 07 '21 10:09 l-nz

vars is the best option i can think of right now, maybe in documentation list information should use 'defines' instead of variables to distinguish between them?

sandorex avatar Sep 08 '21 00:09 sandorex

Another idea could be to use the slightly longer ls user or ls variables or ls vars. This way, ls could maybe show everything and ls user/ls builtin could show the subsets.

If we are discussing this anyway, we might also think about printing (builtin and user) functions. Functions can already be printed by typing their name, but there is no way to list them all.

sharkdp avatar Sep 08 '21 05:09 sharkdp

Another idea could be to use the slightly longer ls user or ls variables or ls vars. This way, ls could maybe show everything and ls user/ls builtin could show the subsets.

I like the idea that ls / list shows everything defined from variables to functions, but ls variables is too long IMO What do you think about defines for non-user variables and vars/variables for user defined?

If we are discussing this anyway, we might also think about printing (builtin and user) functions. Functions can already be printed by typing their name, but there is no way to list them all.

I like builtins for non-user functions but user functions.. hmm can't think of anything other than functions right now

Just throwing ideas around, i want to know your thoughts

sandorex avatar Sep 08 '21 11:09 sandorex

@sharkdp What do you think of just splitting user defined and system defined stuff when running list ? That would reduce a lot of the work and no need for news commands and stuff

sandorex avatar Sep 23 '21 01:09 sandorex

That sounds good to me! We should probably list the user variables at the bottom such that they are better visible (if the list is too long)

sharkdp avatar Oct 02 '21 18:10 sharkdp

maybe ls for easiest to implement option, ls -u filters for user, ls -b filters for built-ins

bradmartin333 avatar Feb 18 '23 02:02 bradmartin333

Maybe I'm just being stupid, but are user and built-ins stored separately? I know I'm missing something, I just don't know what 😅

sadmoonphoenix avatar May 23 '23 17:05 sadmoonphoenix

but are user and built-ins stored separately?

No, this was meant to allow you to see your defined vars easier by visually separating user defined ones from predefined ones but was never done and i stopped using insect

sandorex avatar May 23 '23 18:05 sandorex

Yeah, I don't see why separating them would be useful enough to warrant a rewrite of the variable system. As long as you can see the variables with list (which you can), I don't see an issue.

sadmoonphoenix avatar May 24 '23 03:05 sadmoonphoenix

Yeah, I don't see why separating them would be useful enough to warrant a rewrite of the variable system. As long as you can see the variables with list (which you can), I don't see an issue.

It was never meant to be fully separated, just visually so you could see which ones are which

sandorex avatar May 24 '23 05:05 sandorex

If someone thinks this is still important, please report a follow-up ticket in the Numbat project (the successor project of Insect): https://github.com/sharkdp/numbat

sharkdp avatar Sep 26 '23 20:09 sharkdp