Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi
I'm not really against "-args", though, I'm just trying to look for 
something less ugly. It definitely is the most foolproof solution so far.


Anway, I think it should only apply to a *single* patch. This raises the 
question how to deal with patches passed as "regular" arguments...


You say we shouldn't do the following:

pd -args "1 2 3" patch1.pd -args "foo bar" patch2.pd

So only allow it for patches opened with "-open"?

pd -args "1 2 3" -open patch1.pd -args "foo bar" -open patch2.pd

Christof

On 09.06.2020 18:30, Christof Ressi wrote:



yes, sure.
Your last e-mail indicated otherwise. You showed how you can't open 
"mypatch.pd" as "mypatch", but this was not what Mario was asking.

but what's the point of this discussion?

I just answered a question and you said my answer was wrong.


how is being able to open a file with an arbitrary name (including
arbitrary extensions) related to passing args to Pd?

I've never claimed it was.


it seems that all ideas just fail the
"foolproof test".

True.

On the other hand, let's look at this:

pd "mypatch.pd 1 2 3"

What if we simply treat ".pd " as the delimiter? How many people 
realistically have this character sequence in a directory name? I know 
it's not 100% foolproof, but maybe it's good enough... Just sayin'


Christof

On 09.06.2020 17:50, IOhannes m zmölnig wrote:

On 2020-06-09 17:34, Christof Ressi wrote:

Just to be clear: we're talking about opening a patch file that does not
have the .pd extension, e.g. "mypatch.txt" or simply "mypatch". This
certainly works (at least here on Windows.)

yes, sure. that's what i wrote in my other mail.


but what's the point of this discussion?
how is being able to open a file with an arbitrary name (including
arbitrary extensions) related to passing args to Pd?

i think the much more relevant question in the context of the collapsed
filename+args opening ("pd -open 'foo.pd: 12'") is, whether we can load
patches with spaces in them.
and the answer is of course: yes we can.

so what do i get in this case?:
```
$ ls -1
'foo 42'
foo.pd
'foo.pd: 12'
$ pd -open "foo.pd: 12"
```

while it may seem to be super-elegant to cram as much info into the
shortest possible cmdline, it seems that all ideas just fail the
"foolproof test".
the only character that is forbidden on all systems is "/".
we probably don't want to use *that* tough.

so maybe we should concentrate on other ideas to pass arguments per patch.

gfmards
IOhannes


___
Pd-list@lists.iem.at  mailing list
UNSUBSCRIBE and account-management 
->https://lists.puredata.info/listinfo/pd-list


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi

yes, sure.
Your last e-mail indicated otherwise. You showed how you can't open 
"mypatch.pd" as "mypatch", but this was not what Mario was asking.

but what's the point of this discussion?

I just answered a question and you said my answer was wrong.


how is being able to open a file with an arbitrary name (including
arbitrary extensions) related to passing args to Pd?

I've never claimed it was.


it seems that all ideas just fail the
"foolproof test".

True.

On the other hand, let's look at this:

pd "mypatch.pd 1 2 3"

What if we simply treat ".pd " as the delimiter? How many people 
realistically have this character sequence in a directory name? I know 
it's not 100% foolproof, but maybe it's good enough... Just sayin'


Christof

On 09.06.2020 17:50, IOhannes m zmölnig wrote:

On 2020-06-09 17:34, Christof Ressi wrote:

Just to be clear: we're talking about opening a patch file that does not
have the .pd extension, e.g. "mypatch.txt" or simply "mypatch". This
certainly works (at least here on Windows.)

yes, sure. that's what i wrote in my other mail.


but what's the point of this discussion?
how is being able to open a file with an arbitrary name (including
arbitrary extensions) related to passing args to Pd?

i think the much more relevant question in the context of the collapsed
filename+args opening ("pd -open 'foo.pd: 12'") is, whether we can load
patches with spaces in them.
and the answer is of course: yes we can.

so what do i get in this case?:
```
$ ls -1
'foo 42'
foo.pd
'foo.pd: 12'
$ pd -open "foo.pd: 12"
```

while it may seem to be super-elegant to cram as much info into the
shortest possible cmdline, it seems that all ideas just fail the
"foolproof test".
the only character that is forbidden on all systems is "/".
we probably don't want to use *that* tough.

so maybe we should concentrate on other ideas to pass arguments per patch.

gfmards
IOhannes


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread IOhannes m zmölnig
On 2020-06-09 17:34, Christof Ressi wrote:
> Just to be clear: we're talking about opening a patch file that does not
> have the .pd extension, e.g. "mypatch.txt" or simply "mypatch". This
> certainly works (at least here on Windows.)

yes, sure. that's what i wrote in my other mail.


but what's the point of this discussion?
how is being able to open a file with an arbitrary name (including
arbitrary extensions) related to passing args to Pd?

i think the much more relevant question in the context of the collapsed
filename+args opening ("pd -open 'foo.pd: 12'") is, whether we can load
patches with spaces in them.
and the answer is of course: yes we can.

so what do i get in this case?:
```
$ ls -1
'foo 42'
foo.pd
'foo.pd: 12'
$ pd -open "foo.pd: 12"
```

while it may seem to be super-elegant to cram as much info into the
shortest possible cmdline, it seems that all ideas just fail the
"foolproof test".
the only character that is forbidden on all systems is "/".
we probably don't want to use *that* tough.

so maybe we should concentrate on other ideas to pass arguments per patch.

gfmards
IOhannes



signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi
Just to be clear: we're talking about opening a patch file that does not 
have the .pd extension, e.g. "mypatch.txt" or simply "mypatch". This 
certainly works (at least here on Windows.)


On 09.06.2020 17:27, IOhannes m zmölnig wrote:

On 2020-06-09 15:55, Christof Ressi wrote:

Does Pd open a patch that doesn't have the .pd extension?

Yes.

not here.

```
$ ls -l
mypatch.pd
$ pd -stderr -verbose mypatch.pd
[...]
tried .../mypatch.pd and succeeded
^C
Pd: signal 2
$ pd -stderr -verbose mypatch
[...]
tried .../mypatch and failed
[...]
error: mypatch: can't open
$
```


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread IOhannes m zmölnig
On 2020-06-09 15:55, Christof Ressi wrote:
>> Does Pd open a patch that doesn't have the .pd extension?
> Yes.

not here.

```
$ ls -l
mypatch.pd
$ pd -stderr -verbose mypatch.pd
[...]
tried .../mypatch.pd and succeeded
^C
Pd: signal 2
$ pd -stderr -verbose mypatch
[...]
tried .../mypatch and failed
[...]
error: mypatch: can't open
$
```



signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi

Does Pd open a patch that doesn't have the .pd extension?

Yes.

On 09.06.2020 15:49, Mario Buoninfante wrote:
Yap, absolutely it does make sense, and I wouldn't skip the extension 
unless it was clear that was an accepted behavior.

I guess with mandatory what I mean is:
Does Pd open a patch that doesn't have the .pd extension?

Then whether or not this is good practice it's a different story.
But yes, I do agree that unless this is the case by design (ie no need 
to use .pd), one shouldn't do that.




___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Mario Buoninfante
Yap, absolutely it does make sense, and I wouldn't skip the extension
unless it was clear that was an accepted behavior.
I guess with mandatory what I mean is:
Does Pd open a patch that doesn't have the .pd extension?

Then whether or not this is good practice it's a different story.
But yes, I do agree that unless this is the case by design (ie no need to
use .pd), one shouldn't do that.
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread IOhannes m zmoelnig
On 09.06.20 14:02, Christof Ressi wrote:
> Yes, the .pd extension is not mandatory!

depends on what you mean with "mandatory".

what is mandatory is that the you specify a full filename (not
necessarily the "full path").
if the filename ends with ".pd", you *must* also add the suffix when
calling Pd.
if the filename ends with ".flubber", you *must* also add the suffix
when calling Pd.
if the filename does not end with ".pd" you *must not* specify the
(non-existing) extension.

you cannot leave out arbitrary parts of the filename.

and in general i would not advise to create Pd-patches without the .pd
extension.

gdfasm
IOhannes



signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi
Yes, the .pd extension is not mandatory! In fact, it doesn't even have 
to be a "real" Pd patch. You can also open a .txt file containing a list 
of arbitrary Pd messages.


On 09.06.2020 12:55, Mario Buoninfante wrote:

actually it seems .pd is not mandatory, right?

Anyway I like this :)
pd -open "mypatch1.pd: 1 2 3" -open "mypatch2: foo bar"

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-09 Thread Mario Buoninfante
actually it seems .pd is not mandatory, right?

Anyway I like this :)

pd -open "mypatch1.pd: 1 2 3" -open "mypatch2: foo bar"
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-09 Thread Mario Buoninfante
Good point about colons and semicolons not being 100% safe.
Only thing I would say is that they will only be there after ".pd" and this
should make it safer (easier to parse!?!?!).

+1 for

pd -open "mypatch1.pd: 1 2 3" -open "mypatch2: foo bar"
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-09 Thread Christof Ressi
Actually, I've thought if we could use a semicolon to seperate patch 
from arguments:


pd -open "mypatch1.pd; 1 2 3" -open "mypatch2; foo bar"

Unfortunately, semicolons are not really reserved characters for 
filenames, neither on Windows, nor on Linux/macOS, but their use is 
certainly discouraged.


On the other hand, colons are forbidden characters on Windows and macOS, 
but not on Linux. This means they are not 100% safe, but maybe better 
than semicolons. On Pd we don't need to delimit every argument (because 
arguments are already delimited by spaces), so a single colon between 
patch name and arguments would be sufficient:


pd -open "mypatch1.pd: 1 2 3" -open "mypatch2: foo bar"

Personally, I like this more than using "stateful" command options like 
"-args".


Christof

On 09.06.2020 11:13, Mario Buoninfante wrote:
ChucK uses an interesting syntax to pass arguments to programs that we 
could consider borrowing:


> chuck myprog.ck:23:anotherArg myprog2.ck:42 

that in our case would be:
> pd mypatch.pd:23:anotherArg mypatch2.pd:42



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-09 Thread Mario Buoninfante
ChucK uses an interesting syntax to pass arguments to programs that we
could consider borrowing:

> chuck myprog.ck:23:anotherArg myprog2.ck:42

that in our case would be:
> pd mypatch.pd:23:anotherArg mypatch2.pd:42
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Christof Ressi

this breaks th eexpectations of cmdline processing (a separation between
options with arguments (e.g. '-a "1 2 3"') and 'just arguments"
("patch1.pd patch2.pd").

Agreed.

or should it be the other way round?

pd -args 'foo bar' -open "patch1.pd" -open "patch2.pd"

I tend to agree. It's also easier to parse.


it has the advantage that you can pass the same arguments to multiple
(or all) patches.
it also makes it quite easy to keep compatibility with the "the rest of
the arguments are files" paradigm:

pd -args 24 foo.pd bar.pd


Ugh... stateful command line options are ugly. What if you *don't* want 
to pass the arguments to subsequent patch files? I'd rather restrict the 
'-args' option to a single patch. But I'm not sure how to properly apply 
this to patch files provided as "just arguments". Maybe only allow it 
for patches opened with "-open"?


Christof

On 08.06.2020 20:52, IOhannes m zmölnig wrote:

On 6/8/20 5:49 PM, Christof Ressi wrote:

The thing is that we can load more than one patch. I think something
like this could work:

pd patch1.pd -a "1 2 3" patch2.pd -a "foo bar"

But we could move the bikeshedding to GitHub ;-)
https://github.com/pure-data/pure-data/issues/1058



actually i think that a mailinglist is much better suited for the
bikeshedding tour.

at least for me, i tend to apply a " closed-for-me" tag to all those
issues that have a very high noise-to-signal ratio (and there are quite
a couple of those).
the non-threaded nature of the issues makes it virtually impossible to
keep track of divergent opinions.

so:

pd patch1.pd -a "1 2 3" patch2.pd -a "foo bar"

urgh, no.
this breaks th eexpectations of cmdline processing (a separation between
options with arguments (e.g. '-a "1 2 3"') and 'just arguments"
("patch1.pd patch2.pd"). i think this separation is quite universal in
un*x like environments, and i don't see any compelling reason to
actually break it.

o a more consistent way would be:

pd -open patch1.pd -args "1 2 3" -open "patch2.pd" -args "foo bar"

or should it be the other way round?

pd -args 'foo bar' -open "patch1.pd" -open "patch2.pd"

the inspiration for this is the dollar-expansion in message-boxes.

it has the advantage that you can pass the same arguments to multiple
(or all) patches.
it also makes it quite easy to keep compatibility with the "the rest of
the arguments are files" paradigm:

pd -args 24 foo.pd bar.pd


gsamdr
IOhannes


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread IOhannes m zmölnig
On 6/8/20 5:49 PM, Christof Ressi wrote:
> The thing is that we can load more than one patch. I think something
> like this could work:
> 
> pd patch1.pd -a "1 2 3" patch2.pd -a "foo bar"
> 
> But we could move the bikeshedding to GitHub ;-)
> https://github.com/pure-data/pure-data/issues/1058
> 


actually i think that a mailinglist is much better suited for the
bikeshedding tour.

at least for me, i tend to apply a " closed-for-me" tag to all those
issues that have a very high noise-to-signal ratio (and there are quite
a couple of those).
the non-threaded nature of the issues makes it virtually impossible to
keep track of divergent opinions.

so:
> pd patch1.pd -a "1 2 3" patch2.pd -a "foo bar"

urgh, no.
this breaks th eexpectations of cmdline processing (a separation between
options with arguments (e.g. '-a "1 2 3"') and 'just arguments"
("patch1.pd patch2.pd"). i think this separation is quite universal in
un*x like environments, and i don't see any compelling reason to
actually break it.

o a more consistent way would be:
> pd -open patch1.pd -args "1 2 3" -open "patch2.pd" -args "foo bar"

or should it be the other way round?
> pd -args 'foo bar' -open "patch1.pd" -open "patch2.pd"

the inspiration for this is the dollar-expansion in message-boxes.

it has the advantage that you can pass the same arguments to multiple
(or all) patches.
it also makes it quite easy to keep compatibility with the "the rest of
the arguments are files" paradigm:
> pd -args 24 foo.pd bar.pd


gsamdr
IOhannes



signature.asc
Description: OpenPGP digital signature
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal - Test Suite

2020-06-08 Thread Jack
However, cool to have tests in Pd ;)
For the name : Pure DAT (Pure Data Auto Tests).
Too close to Pure Data ? Sure !
++

Jacj



Le 08/06/2020 à 17:55, Jack a écrit :
> For french people, after "pd", we have "pedant" :D
> I love !
> https://en.wiktionary.org/wiki/p%C3%A9dant
> ++
> 
> Jack
> 
> 
> 
> Le 08/06/2020 à 17:40, Christof Ressi a écrit :
>> Big thumps up for test suits! BTW, IOhannes has already been working on
>> a testing framework for Pd: https://git.iem.at/pd/pedant
>>
>> Christof
>>
>> On 08.06.2020 17:34, Mario Buoninfante wrote:
>>> Yap, in the end I put a [receive] in the patch as a workaround.
>>> I'll open a ticket on github then, I suppose this could be useful.
>>>
>>> Just to give you a bit more context here, the reason why I'm asking
>>> for this is because I'm prototyping a test suite for Pd - ie for
>>> "continuous integration' or simply for testing new features.
>>> I wanted to contribute a bit more to the cause and since this seems to
>>> be something we're missing atm, I thought I could spend some time on this.
>>> It would be great to have some scripts in place that allow us to check
>>> new and old features, to make sure things work fine on different OSs
>>> and machines and that we haven't broken anything while working on a
>>> new feature.
>>> As a starting point we could have Pd users running the suite on their
>>> machine and share the logs/results.
>>> I'm prototyping something simple in Lua simple, that shouldn't require
>>> too much effort in terms of maintenance.
>>>
>>> I'll open a ticket on github and share more details there.
>>>
>>> Please, let me know if you have any thoughts/suggestions/questions.
>>>
>>> Cheers,
>>> Mario
>>>
>>>
>>> ___
>>> Pd-list@lists.iem.at mailing list
>>> UNSUBSCRIBE and account-management -> 
>>> https://lists.puredata.info/listinfo/pd-list
>>
>> ___
>> Pd-list@lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> 
>> https://lists.puredata.info/listinfo/pd-list
>>
> 
> 
> 
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
> 




___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal - Test Suite

2020-06-08 Thread Jack
For french people, after "pd", we have "pedant" :D
I love !
https://en.wiktionary.org/wiki/p%C3%A9dant
++

Jack



Le 08/06/2020 à 17:40, Christof Ressi a écrit :
> Big thumps up for test suits! BTW, IOhannes has already been working on
> a testing framework for Pd: https://git.iem.at/pd/pedant
> 
> Christof
> 
> On 08.06.2020 17:34, Mario Buoninfante wrote:
>> Yap, in the end I put a [receive] in the patch as a workaround.
>> I'll open a ticket on github then, I suppose this could be useful.
>>
>> Just to give you a bit more context here, the reason why I'm asking
>> for this is because I'm prototyping a test suite for Pd - ie for
>> "continuous integration' or simply for testing new features.
>> I wanted to contribute a bit more to the cause and since this seems to
>> be something we're missing atm, I thought I could spend some time on this.
>> It would be great to have some scripts in place that allow us to check
>> new and old features, to make sure things work fine on different OSs
>> and machines and that we haven't broken anything while working on a
>> new feature.
>> As a starting point we could have Pd users running the suite on their
>> machine and share the logs/results.
>> I'm prototyping something simple in Lua simple, that shouldn't require
>> too much effort in terms of maintenance.
>>
>> I'll open a ticket on github and share more details there.
>>
>> Please, let me know if you have any thoughts/suggestions/questions.
>>
>> Cheers,
>> Mario
>>
>>
>> ___
>> Pd-list@lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> 
>> https://lists.puredata.info/listinfo/pd-list
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
> 




___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Christof Ressi
The thing is that we can load more than one patch. I think something 
like this could work:


pd patch1.pd -a "1 2 3" patch2.pd -a "foo bar"

But we could move the bikeshedding to GitHub ;-) 
https://github.com/pure-data/pure-data/issues/1058


Christof

On 08.06.2020 17:09, Dan Wilcox wrote:
Or Pd can recognize the "--" flag which disables command line parsing 
hereafter. I looked into this as it was helpful for debugging the 
sound file stuff and found it was an easy change to make. I just never 
formalized it for a PR etc.


On Jun 8, 2020, at 5:00 PM, pd-list-requ...@lists.iem.at 
<mailto:pd-list-requ...@lists.iem.at> wrote:


Date: Mon, 8 Jun 2020 15:12:34 +0100
From: Sebastian Lexer <mailto:s.le...@incalcando.com>>
To: Pd-List mailto:pd-list@lists.iem.at>>, 
Christof Ressi

mailto:i...@christofressi.com>>
Subject: Re: [PD] Pass arg to Pd via terminal
Message-ID: <5ef354dd-97bc-4cbc-bc3b-a1df8c93fcae@Spark>
Content-Type: text/plain; charset="utf-8"

I like this idea very much! Could there be an argument flag? e.g.

$ pd mypatch.pd -a 23

Basically like terminal commands in sox, where the flags apply to 
import and output files dependent on the placement, in PD it could 
work as flags for PD before and in between the filename(s) to be opened.



Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com>
robotcowboy.com <http://robotcowboy.com>



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal - Test Suite

2020-06-08 Thread Christof Ressi
Big thumps up for test suits! BTW, IOhannes has already been working on 
a testing framework for Pd: https://git.iem.at/pd/pedant


Christof

On 08.06.2020 17:34, Mario Buoninfante wrote:

Yap, in the end I put a [receive] in the patch as a workaround.
I'll open a ticket on github then, I suppose this could be useful.

Just to give you a bit more context here, the reason why I'm asking 
for this is because I'm prototyping a test suite for Pd - ie for 
"continuous integration' or simply for testing new features.
I wanted to contribute a bit more to the cause and since this seems to 
be something we're missing atm, I thought I could spend some time on this.
It would be great to have some scripts in place that allow us to check 
new and old features, to make sure things work fine on different OSs 
and machines and that we haven't broken anything while working on a 
new feature.
As a starting point we could have Pd users running the suite on their 
machine and share the logs/results.
I'm prototyping something simple in Lua simple, that shouldn't require 
too much effort in terms of maintenance.


I'll open a ticket on github and share more details there.

Please, let me know if you have any thoughts/suggestions/questions.

Cheers,
Mario


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal - Test Suite

2020-06-08 Thread Mario Buoninfante
Yap, in the end I put a [receive] in the patch as a workaround.
I'll open a ticket on github then, I suppose this could be useful.

Just to give you a bit more context here, the reason why I'm asking for
this is because I'm prototyping a test suite for Pd - ie for "continuous
integration' or simply for testing new features.
I wanted to contribute a bit more to the cause and since this seems to be
something we're missing atm, I thought I could spend some time on this.
It would be great to have some scripts in place that allow us to check new
and old features, to make sure things work fine on different OSs and
machines and that we haven't broken anything while working on a new feature.
As a starting point we could have Pd users running the suite on their
machine and share the logs/results.
I'm prototyping something simple in Lua simple, that shouldn't require too
much effort in terms of maintenance.

I'll open a ticket on github and share more details there.

Please, let me know if you have any thoughts/suggestions/questions.

Cheers,
Mario
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Dan Wilcox
Or Pd can recognize the "--" flag which disables command line parsing 
hereafter. I looked into this as it was helpful for debugging the sound file 
stuff and found it was an easy change to make. I just never formalized it for a 
PR etc.

> On Jun 8, 2020, at 5:00 PM, pd-list-requ...@lists.iem.at wrote:
> 
> Date: Mon, 8 Jun 2020 15:12:34 +0100
> From: Sebastian Lexer mailto:s.le...@incalcando.com>>
> To: Pd-List mailto:pd-list@lists.iem.at>>, Christof 
> Ressi
>   mailto:i...@christofressi.com>>
> Subject: Re: [PD] Pass arg to Pd via terminal
> Message-ID: <5ef354dd-97bc-4cbc-bc3b-a1df8c93fcae@Spark>
> Content-Type: text/plain; charset="utf-8"
> 
> I like this idea very much! Could there be an argument flag? e.g.
> 
> $ pd mypatch.pd -a 23
> 
> Basically like terminal commands in sox, where the flags apply to import and 
> output files dependent on the placement, in PD it could work as flags for PD 
> before and in between the filename(s) to be opened.


Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com/>
robotcowboy.com <http://robotcowboy.com/>



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Sebastian Lexer
I like this idea very much! Could there be an argument flag? e.g.

$ pd mypatch.pd -a 23

Basically like terminal commands in sox, where the flags apply to import and 
output files dependent on the placement, in PD it could work as flags for PD 
before and in between the filename(s) to be opened.

Sebastian
On 8 Jun 2020, 14:54 +0100, Christof Ressi , wrote:
> Ah, that's an interesting idea. Unfortunately, your proposed syntax wouldn't 
> work because any arguments after the flags are treated as patch files, so in 
> your case Pd would try to open "mypatch.pd" and "23".
> Top level patches usually don't use creation arguments because it is not 
> really possible to provide them with the current opening mechanism. But I 
> totally see how this could be useful. It would need some surgery in Pd, 
> though. Feel free to open an issue on GitHub!
> In the meantime, you can have a wrapper patch with a receiver which 
> dynamically creates the actual patch with the desired creation arguments.
> Christof
> On 08.06.2020 15:23, Mario Buoninfante wrote:
> > Hi Jack,
> >
> > Thanks for your help. That's great but is not exactly what I'm looking for.
> > In my previous email I missed an important bit, what I'd like to do is pass 
> > an arg to a specific patch.
> > Something like
> >
> > > pd mypatch.pd 23
> >
> > and then in "mypatch" I have [$1] that is now 23.
> >
> > Cheers,
> > Mario
> >
> >
> > ___
> > Pd-list@lists.iem.at mailing list
> > UNSUBSCRIBE and account-management -> 
> > https://lists.puredata.info/listinfo/pd-list
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Christof Ressi
Ah, that's an interesting idea. Unfortunately, your proposed syntax 
wouldn't work because any arguments after the flags are treated as patch 
files, so in your case Pd would try to open "mypatch.pd" and "23".


Top level patches usually don't use creation arguments because it is not 
really possible to provide them with the current opening mechanism. But 
I totally see how this could be useful. It would need some surgery in 
Pd, though. Feel free to open an issue on GitHub!


In the meantime, you can have a wrapper patch with a receiver which 
dynamically creates the actual patch with the desired creation arguments.


Christof

On 08.06.2020 15:23, Mario Buoninfante wrote:

Hi Jack,

Thanks for your help. That's great but is not exactly what I'm looking 
for.
In my previous email I missed an important bit, what I'd like to do is 
pass an arg to a specific patch.

Something like

> pd mypatch.pd 23

and then in "mypatch" I have [$1] that is now 23.

Cheers,
Mario


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-08 Thread Mario Buoninfante
Hi Christof,

Just read your email, thanks guys for your help!


Cheers,
Mario
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-08 Thread Mario Buoninfante
Hi Jack,

Thanks for your help. That's great but is not exactly what I'm looking for.
In my previous email I missed an important bit, what I'd like to do is pass
an arg to a specific patch.
Something like

> pd mypatch.pd 23

and then in "mypatch" I have [$1] that is now 23.

Cheers,
Mario
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Christof Ressi

To expand on Jack's answer:

pd -send "foo baz; bar 1 2 3;"

This will send 'baz' to the receiver 'foo' and '1 2 3' to the receiver 
'bar'.


---

Here's a caveat for all Msys2 users on Windows: by default the Msys2 
terminal interprets messages starting with a forward slash as absolute 
file paths and prepends them with the Msys2 installation path. For example,


pd -send "/foo/bar 1 2 3"

will yield the following Pd error:

"C:/msys64/foo/bar: no such object"

Apparantly there's a way to turn this off with an environmental variable 
but I couldn't make it work. A possible workaround is to replace the 
first forward slash with a backslash:


pd -send "\foo/bar 1 2 3"

I once had been tearing my hear out for 1 hour, so I thought I'd better 
share this.


Christof

On 08.06.2020 14:32, Mario Buoninfante wrote:
On 08.06.2020 14:43, Jack wrote:

Hello Mario,

If you do :
$ pd --help

you should get a line with :
-send "msg..."   -- send a message at startup, after patches are loaded

++

Jack



Le 08/06/2020 à 14:32, Mario Buoninfante a écrit :

Hi,

Is it possible to pass arguments to Pd via terminal?
I know we don't have [stdin], but I was wondering if there is any other way.

Cheers,
Mario

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list





___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list




___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Pass arg to Pd via terminal

2020-06-08 Thread Jack
Hello Mario,

If you do :
$ pd --help

you should get a line with :
-send "msg..."   -- send a message at startup, after patches are loaded

++

Jack



Le 08/06/2020 à 14:32, Mario Buoninfante a écrit :
> Hi,
> 
> Is it possible to pass arguments to Pd via terminal?
> I know we don't have [stdin], but I was wondering if there is any other way.
> 
> Cheers,
> Mario
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
> 




___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Pass arg to Pd via terminal

2020-06-08 Thread Mario Buoninfante
Hi,

Is it possible to pass arguments to Pd via terminal?
I know we don't have [stdin], but I was wondering if there is any other way.

Cheers,
Mario
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list