output file argument to notmuch dump.

2011-10-11 Thread David Bremner
On Mon, 10 Oct 2011 09:41:47 -0700, Jameson Graef Rollins  wrote:

> >notmuch --stdout=foo.txt dump
> > 
> > could be dealt with later.
> 
> I realize the later probably requires more work, since we would have to
> replace all print calls with a new function, but I think it's the
> cleaner and more elegant solution.  There's no reason to have an output
> redirection option for "dump"s and not for any of the other commands.

As far as I know, freopen(3) makes this a one-liner. I think the hardest
part of this would be figuring out the name of the option ;)

d





output file argument to notmuch dump.

2011-10-10 Thread Tomi Ollila
On Sun 09 Oct 2011 19:01, David Bremner  writes:

> On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
>> 
>> I'd like to add a search term argument to notmuch dump (see
>> id:"87wrcijn1w.fsf at zancas.localnet" and followup for context). The
>> "notmuch" way would be to have
>> 
>> notmuch dump 
>> 
>> do the right thing
>
> Another option occured to me that is consistent at least with notmuch
> tag and notmuch show would be to support the following transitional
> syntaxes
>
> notmuch dump file
> notmuch dump file [--] search terms
> notmuch dump -- search terms
>
> the first two could then be deprecated, and eventually the syntax
>
> notmuch dump search terms 
>
> could be enabled.

In this case there would be 2 transitional syntaxes. IMHO 

'notmuch dump ' causes least transitional pain.

> the question of whether to support 
>
> notmuch dump --file foo.txt
>
> or something like 
>
>notmuch --stdout=foo.txt dump

who about 

notmuch [--output-file=]  ...

> could be dealt with later.
>
> David

Tomi


output file argument to notmuch dump.

2011-10-10 Thread David Bremner
On Mon, 10 Oct 2011 16:59:06 +0300, Tomi Ollila  wrote:
> 
> In this case there would be 2 transitional syntaxes. IMHO 
> 
> 'notmuch dump ' causes least transitional pain.
> 

I don't understand what you mean here. Can you elaborate?

  notmuch dump  

is not a transitional syntax, but rather a new syntax that breaks
existing scripts. 

The advantage of using -- here is that it allows things like

notmuch dump --format=something-better -- --output

to search for --output (of course the query is then parsed a bit
surprisingly, but this is a different issue.)

d
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-10 Thread Tomi Ollila
On Fri 07 Oct 2011 20:22, Jameson Graef Rollins  
writes:

> On Fri, 07 Oct 2011 14:15:39 +0300, Tomi Ollila  wrote:
>> The option 2, i.e. optional --write (or -o|--output) should be available;
>> someone may run notmuch without using environment that provides
>> redirections (or it is just plain simpler to give the command line option
>> instead of doing redirections).
>
> If that were the case then none of the other notmuch commands would work
> in the environment either.  If that's a concern, then notmuch should
> have a generic --redirect option that works for all commands, as Tom
> suggested out earlier.

Good point. I Agree. So, no spesific --write|-o|--output for dump is my
current vote.

>
> jamie.

Tomi


output file argument to notmuch dump.

2011-10-10 Thread Jameson Graef Rollins
On Sun, 09 Oct 2011 13:01:53 -0300, David Bremner  wrote:
> Another option occured to me that is consistent at least with notmuch
> tag and notmuch show would be to support the following transitional
> syntaxes
> 
> notmuch dump file
> notmuch dump file [--] search terms
> notmuch dump -- search terms
> 
> the first two could then be deprecated, and eventually the syntax
> 
> notmuch dump search terms 
> 
> could be enabled.

Hey, David.  I think this is a fine approach, Go with the transitional
"--" separator for one release or so, with a deprecation warning, and
then move to the standard form in the release after that.

> the question of whether to support 
> 
> notmuch dump --file foo.txt
> 
> or something like 
> 
>notmuch --stdout=foo.txt dump
> 
> could be dealt with later.

I realize the later probably requires more work, since we would have to
replace all print calls with a new function, but I think it's the
cleaner and more elegant solution.  There's no reason to have an output
redirection option for "dump"s and not for any of the other commands.

jamie.


-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: output file argument to notmuch dump.

2011-10-10 Thread David Bremner
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:
 
 I'd like to add a search term argument to notmuch dump (see
 id:87wrcijn1w.fsf@zancas.localnet and followup for context). The
 notmuch way would be to have
 
 notmuch dump search-term
 
 do the right thing

Another option occured to me that is consistent at least with notmuch
tag and notmuch show would be to support the following transitional
syntaxes

notmuch dump file
notmuch dump file [--] search terms
notmuch dump -- search terms

the first two could then be deprecated, and eventually the syntax

notmuch dump search terms 

could be enabled.

the question of whether to support 

notmuch dump --file foo.txt

or something like 

   notmuch --stdout=foo.txt dump

could be dealt with later.

David


pgpkM1rfvjuR2.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-10 Thread Tomi Ollila
On Fri 07 Oct 2011 20:22, Jameson Graef Rollins jroll...@finestructure.net 
writes:

 On Fri, 07 Oct 2011 14:15:39 +0300, Tomi Ollila tomi.oll...@iki.fi wrote:
 The option 2, i.e. optional --write (or -o|--output) should be available;
 someone may run notmuch without using environment that provides
 redirections (or it is just plain simpler to give the command line option
 instead of doing redirections).

 If that were the case then none of the other notmuch commands would work
 in the environment either.  If that's a concern, then notmuch should
 have a generic --redirect option that works for all commands, as Tom
 suggested out earlier.

Good point. I Agree. So, no spesific --write|-o|--output for dump is my
current vote.


 jamie.

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-10 Thread David Bremner
On Mon, 10 Oct 2011 16:59:06 +0300, Tomi Ollila tomi.oll...@iki.fi wrote:
 
 In this case there would be 2 transitional syntaxes. IMHO 
 
 'notmuch dump search-terms' causes least transitional pain.
 

I don't understand what you mean here. Can you elaborate?

  notmuch dump search-terms 

is not a transitional syntax, but rather a new syntax that breaks
existing scripts. 

The advantage of using -- here is that it allows things like

notmuch dump --format=something-better -- --output

to search for --output (of course the query is then parsed a bit
surprisingly, but this is a different issue.)

d


pgpjTeEPfs5ak.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-10 Thread Jameson Graef Rollins
On Sun, 09 Oct 2011 13:01:53 -0300, David Bremner brem...@unb.ca wrote:
 Another option occured to me that is consistent at least with notmuch
 tag and notmuch show would be to support the following transitional
 syntaxes
 
 notmuch dump file
 notmuch dump file [--] search terms
 notmuch dump -- search terms
 
 the first two could then be deprecated, and eventually the syntax
 
 notmuch dump search terms 
 
 could be enabled.

Hey, David.  I think this is a fine approach, Go with the transitional
-- separator for one release or so, with a deprecation warning, and
then move to the standard form in the release after that.

 the question of whether to support 
 
 notmuch dump --file foo.txt
 
 or something like 
 
notmuch --stdout=foo.txt dump
 
 could be dealt with later.

I realize the later probably requires more work, since we would have to
replace all print calls with a new function, but I think it's the
cleaner and more elegant solution.  There's no reason to have an output
redirection option for dumps and not for any of the other commands.

jamie.




pgpJgJnG05vdS.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-10 Thread David Bremner
On Mon, 10 Oct 2011 09:41:47 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:

 notmuch --stdout=foo.txt dump
  
  could be dealt with later.
 
 I realize the later probably requires more work, since we would have to
 replace all print calls with a new function, but I think it's the
 cleaner and more elegant solution.  There's no reason to have an output
 redirection option for dumps and not for any of the other commands.

As far as I know, freopen(3) makes this a one-liner. I think the hardest
part of this would be figuring out the name of the option ;)

d



___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


output file argument to notmuch dump.

2011-10-09 Thread David Bremner
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
> 
> I'd like to add a search term argument to notmuch dump (see
> id:"87wrcijn1w.fsf at zancas.localnet" and followup for context). The
> "notmuch" way would be to have
> 
> notmuch dump 
> 
> do the right thing

Another option occured to me that is consistent at least with notmuch
tag and notmuch show would be to support the following transitional
syntaxes

notmuch dump file
notmuch dump file [--] search terms
notmuch dump -- search terms

the first two could then be deprecated, and eventually the syntax

notmuch dump search terms 

could be enabled.

the question of whether to support 

notmuch dump --file foo.txt

or something like 

   notmuch --stdout=foo.txt dump

could be dealt with later.

David
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-07 Thread Tomi Ollila
On Fri 07 Oct 2011 13:23, Jesse Rosenthal  writes:

> On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
>> 1) just delete the output file option from notmuch-dump, and use shell
>>redirection. So far I don't see a non-contrived example when writing
>>an output file directly is useful, but maybe that is just a failure
>>of imagination.
>> 
>> 2) delete the output file option and a global "--write" option that 
>>calls freopen(... stdout). As a bonus(?) this would work for any 
>>notmuch command.
>
> Either of these seem like the right approach to me. I might favor (1)
> just a bit so I don't have to choose between different ways of doing the
> same thing, but that's a small point. As Jamie said, they're pretty
> much the same.

The option 2, i.e. optional --write (or -o|--output) should be available;
someone may run notmuch without using environment that provides
redirections (or it is just plain simpler to give the command line option
instead of doing redirections).

> --Jesse

Tomi


output file argument to notmuch dump.

2011-10-07 Thread Jameson Graef Rollins
On Fri, 07 Oct 2011 14:15:39 +0300, Tomi Ollila  wrote:
> The option 2, i.e. optional --write (or -o|--output) should be available;
> someone may run notmuch without using environment that provides
> redirections (or it is just plain simpler to give the command line option
> instead of doing redirections).

If that were the case then none of the other notmuch commands would work
in the environment either.  If that's a concern, then notmuch should
have a generic --redirect option that works for all commands, as Tom
suggested out earlier.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-07 Thread Jesse Rosenthal
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
> 1) just delete the output file option from notmuch-dump, and use shell
>redirection. So far I don't see a non-contrived example when writing
>an output file directly is useful, but maybe that is just a failure
>of imagination.
> 
> 2) delete the output file option and a global "--write" option that 
>calls freopen(... stdout). As a bonus(?) this would work for any 
>notmuch command.

Either of these seem like the right approach to me. I might favor (1)
just a bit so I don't have to choose between different ways of doing the
same thing, but that's a small point. As Jamie said, they're pretty
much the same.

--Jesse


output file argument to notmuch dump.

2011-10-07 Thread Dmitry Kurochkin
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
> 
> I'd like to add a search term argument to notmuch dump (see
> id:"87wrcijn1w.fsf at zancas.localnet" and followup for context). The
> "notmuch" way would be to have
> 
> notmuch dump 
> 
> do the right thing, and that is easy enough _except_ that 
> 
>notmuch dump foo
> 
> writes the output to file foo.
> 
> I see several options.
> 
> 1) just delete the output file option from notmuch-dump, and use shell
>redirection. So far I don't see a non-contrived example when writing
>an output file directly is useful, but maybe that is just a failure
>of imagination.
> 
> 2) delete the output file option and a global "--write" option that 
>calls freopen(... stdout). As a bonus(?) this would work for any 
>notmuch command.
> 
> 3) leave the output option alone and implement a --query=foo option for 
>notmuch dump. This would be the most backward compatible of course,
>but also confusing for users.
> 
> Thoughts?
> 

IMHO 1[+2] is the way.  It breaks the dump command interface, but would
make it consistent with other commands.  Implementing the second option
(for all commands) is nice but independent and optional.  Also, perhaps
--output, --output-file or smth would a better name than --write.

Regards,
  Dmitry

> d
> 
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-07 Thread Jesse Rosenthal
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:
 1) just delete the output file option from notmuch-dump, and use shell
redirection. So far I don't see a non-contrived example when writing
an output file directly is useful, but maybe that is just a failure
of imagination.
 
 2) delete the output file option and a global --write option that 
calls freopen(... stdout). As a bonus(?) this would work for any 
notmuch command.

Either of these seem like the right approach to me. I might favor (1)
just a bit so I don't have to choose between different ways of doing the
same thing, but that's a small point. As Jamie said, they're pretty
much the same.

--Jesse
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-07 Thread Tomi Ollila
On Fri 07 Oct 2011 13:23, Jesse Rosenthal jrosent...@jhu.edu writes:

 On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:
 1) just delete the output file option from notmuch-dump, and use shell
redirection. So far I don't see a non-contrived example when writing
an output file directly is useful, but maybe that is just a failure
of imagination.
 
 2) delete the output file option and a global --write option that 
calls freopen(... stdout). As a bonus(?) this would work for any 
notmuch command.

 Either of these seem like the right approach to me. I might favor (1)
 just a bit so I don't have to choose between different ways of doing the
 same thing, but that's a small point. As Jamie said, they're pretty
 much the same.

The option 2, i.e. optional --write (or -o|--output) should be available;
someone may run notmuch without using environment that provides
redirections (or it is just plain simpler to give the command line option
instead of doing redirections).

 --Jesse

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-07 Thread Jameson Graef Rollins
On Fri, 07 Oct 2011 14:15:39 +0300, Tomi Ollila tomi.oll...@iki.fi wrote:
 The option 2, i.e. optional --write (or -o|--output) should be available;
 someone may run notmuch without using environment that provides
 redirections (or it is just plain simpler to give the command line option
 instead of doing redirections).

If that were the case then none of the other notmuch commands would work
in the environment either.  If that's a concern, then notmuch should
have a generic --redirect option that works for all commands, as Tom
suggested out earlier.

jamie.


pgpe3hUHrhUuy.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


output file argument to notmuch dump.

2011-10-06 Thread David Bremner
On Fri, 07 Oct 2011 04:37:56 +0400, Dmitry Kurochkin  wrote:
> On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:

> IMHO 1[+2] is the way.  It breaks the dump command interface, but would
> make it consistent with other commands.  Implementing the second option
> (for all commands) is nice but independent and optional.  Also, perhaps
> --output, --output-file or smth would a better name than --write.

I'm not fussy about the name, except that --output is taken, and I
thought there might be some benefit of making options have unique prefixes.

d
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-06 Thread Tom Prince
On Thu, 06 Oct 2011 21:53:57 -0300, David Bremner  wrote:
> On Fri, 07 Oct 2011 04:37:56 +0400, Dmitry Kurochkin  gmail.com> wrote:
> > On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
> 
> > IMHO 1[+2] is the way.  It breaks the dump command interface, but would
> > make it consistent with other commands.  Implementing the second option
> > (for all commands) is nice but independent and optional.  Also, perhaps
> > --output, --output-file or smth would a better name than --write.
> 
> I'm not fussy about the name, except that --output is taken, and I
> thought there might be some benefit of making options have unique
> prefixes.

Is -o/--output taken before the subcommand? i.e.
notmuch -o  dump  
Or would that be to confusing?

(-o is fairly standard for stdout redirection, so it would be nice to
use that for notmuch, as well.)

  Tom


output file argument to notmuch dump.

2011-10-06 Thread David Bremner

I'd like to add a search term argument to notmuch dump (see
id:"87wrcijn1w.fsf at zancas.localnet" and followup for context). The
"notmuch" way would be to have

notmuch dump 

do the right thing, and that is easy enough _except_ that 

   notmuch dump foo

writes the output to file foo.

I see several options.

1) just delete the output file option from notmuch-dump, and use shell
   redirection. So far I don't see a non-contrived example when writing
   an output file directly is useful, but maybe that is just a failure
   of imagination.

2) delete the output file option and a global "--write" option that 
   calls freopen(... stdout). As a bonus(?) this would work for any 
   notmuch command.

3) leave the output option alone and implement a --query=foo option for 
   notmuch dump. This would be the most backward compatible of course,
   but also confusing for users.

Thoughts?

d


-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-06 Thread Jameson Graef Rollins
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner  wrote:
> I see several options.
> 
> 1) just delete the output file option from notmuch-dump, and use shell
>redirection. So far I don't see a non-contrived example when writing
>an output file directly is useful, but maybe that is just a failure
>of imagination.
> 
> 2) delete the output file option and a global "--write" option that 
>calls freopen(... stdout). As a bonus(?) this would work for any 
>notmuch command.

I strongly support either of these two options (they're basically the
same as far as I'm concerned).  The consistency that this would provide
with rest of the notmuch commands alone kind of makes this a no-brainer
in my opinion.  And I certainly don't see this particular CLI breakage
as an issue either.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



output file argument to notmuch dump.

2011-10-06 Thread David Bremner

I'd like to add a search term argument to notmuch dump (see
id:87wrcijn1w.fsf@zancas.localnet and followup for context). The
notmuch way would be to have

notmuch dump search-term

do the right thing, and that is easy enough _except_ that 

   notmuch dump foo

writes the output to file foo.

I see several options.

1) just delete the output file option from notmuch-dump, and use shell
   redirection. So far I don't see a non-contrived example when writing
   an output file directly is useful, but maybe that is just a failure
   of imagination.

2) delete the output file option and a global --write option that 
   calls freopen(... stdout). As a bonus(?) this would work for any 
   notmuch command.

3) leave the output option alone and implement a --query=foo option for 
   notmuch dump. This would be the most backward compatible of course,
   but also confusing for users.

Thoughts?

d




pgpuDZkirzU7W.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-06 Thread Dmitry Kurochkin
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:
 
 I'd like to add a search term argument to notmuch dump (see
 id:87wrcijn1w.fsf@zancas.localnet and followup for context). The
 notmuch way would be to have
 
 notmuch dump search-term
 
 do the right thing, and that is easy enough _except_ that 
 
notmuch dump foo
 
 writes the output to file foo.
 
 I see several options.
 
 1) just delete the output file option from notmuch-dump, and use shell
redirection. So far I don't see a non-contrived example when writing
an output file directly is useful, but maybe that is just a failure
of imagination.
 
 2) delete the output file option and a global --write option that 
calls freopen(... stdout). As a bonus(?) this would work for any 
notmuch command.
 
 3) leave the output option alone and implement a --query=foo option for 
notmuch dump. This would be the most backward compatible of course,
but also confusing for users.
 
 Thoughts?
 

IMHO 1[+2] is the way.  It breaks the dump command interface, but would
make it consistent with other commands.  Implementing the second option
(for all commands) is nice but independent and optional.  Also, perhaps
--output, --output-file or smth would a better name than --write.

Regards,
  Dmitry

 d
 
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-06 Thread David Bremner
On Fri, 07 Oct 2011 04:37:56 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:

 IMHO 1[+2] is the way.  It breaks the dump command interface, but would
 make it consistent with other commands.  Implementing the second option
 (for all commands) is nice but independent and optional.  Also, perhaps
 --output, --output-file or smth would a better name than --write.

I'm not fussy about the name, except that --output is taken, and I
thought there might be some benefit of making options have unique prefixes.

d


pgpZ0QAwIdijG.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: output file argument to notmuch dump.

2011-10-06 Thread Jameson Graef Rollins
On Thu, 06 Oct 2011 21:20:40 -0300, David Bremner brem...@unb.ca wrote:
 I see several options.
 
 1) just delete the output file option from notmuch-dump, and use shell
redirection. So far I don't see a non-contrived example when writing
an output file directly is useful, but maybe that is just a failure
of imagination.
 
 2) delete the output file option and a global --write option that 
calls freopen(... stdout). As a bonus(?) this would work for any 
notmuch command.

I strongly support either of these two options (they're basically the
same as far as I'm concerned).  The consistency that this would provide
with rest of the notmuch commands alone kind of makes this a no-brainer
in my opinion.  And I certainly don't see this particular CLI breakage
as an issue either.

jamie.


pgpwMNtCDrJbk.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch