Replies: 1 comment 2 replies
-
Following up from the the FR:
For e.g.:
Maybe function name needs to be quoted . |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sorry for the undescriptive title! Maybe I'll invent a better title later.
I was thinking about a solution for the
{{tags}}
variable's separator escaping issue. I got an idea, which can be expanded to more than separators.I'll start directly with examples:
{{tags}}->join(,)
{{tags}}->count()
{{file_name}}->length()
{{file_name}}->or(A value that will be given when no file is active.)
join()
,count()
,length()
andor()
are methods. This term is used in Object Oriented Programming (OOP).Methods need to be accessed with
->
operator. I borrowed this from PHP programming language. A more common operator in other languages would have been.
, but I wanted to have something that is is uncommon in shell commands, and for this reason a two characters long operator should do pretty well.join()
takes one argument, a separator to join a list of values together.I'll tell more on the individual
join()
,count()
,length()
and->or()
methods later, by the time I plan on implementing them.join()
and probablycount()
will be the first ones, others later.This will allow even more methods to be created later.
Maybe some other parenthesis than
(
and)
?->join{{,}}
?->join((,))
?->join[[,]]
?The issue with
(
and)
is that as single character parenthesis, they are quite common and a user might want to use them in an argument for a method.Escaping
So far I would think that methods should not do any escaping to what they return. This also means that future methods should be designed in a way, that they will not need escaping. But as this idea is very, very new to me, I might need to change my mind in the future.
Variables that return lists
Currently, the
{{tags}}
variable is the only variable that returns some kind of a list. Because a shell command is always text, all variables need to return text, too, so that they can be inserted into the shell command.For list like variables, such as
{{tags}}
, the behavior will change so that the variable cannot be used in its base form:{{tags}}
. Instead, the variable must be extended with a method call:{{tags}}->join(add your separator here)
, or{{tags}}->count()
. Those methods return values that can be inserted into a shell command.Also custom variables will some day support list type of variables.
Beta Was this translation helpful? Give feedback.
All reactions