Opened 16 years ago

Closed 13 years ago

#4753 closed enhancement (fixed)

bash completion file for lyx

Reported by: sven@… Owned by: lasgouttes
Priority: low Milestone: 2.0.0
Component: general Version: 1.5.4
Severity: minor Keywords:
Cc: rgheck@…, ps@…, cengique@…

Description (last modified by ps)

Hi,
Cengiz Gunay contributed a bash completion file for lyx. We'll include it in the
next Debian package but it's something of general interest for Linux/Unix users
so that it would make sense to place it somewhere in the LyX tarball.

Sven

Attachments (3)

bash_completion (502 bytes ) - added by sven@… 16 years ago.
bash completion file for lyx
export-options.patch (1.1 KB ) - added by Cengiz Günay 14 years ago.
Patch for completing file names for --export and -e options.
debug-options.patch (1.8 KB ) - added by Cengiz Günay 14 years ago.
Patch to r34001 for adding comma-separated options to -dbg and added missing option -batch

Download all attachments as: .zip

Change History (33)

by sven@…, 16 years ago

Attachment: bash_completion added

bash completion file for lyx

comment:1 by lasgouttes, 16 years ago

Or maybe on the wiki?

comment:2 by sven@…, 16 years ago

From a packagers point of view I'd prefer to see it in the upstream tarball in
some kind of contrib folder. Actually LyX has currently no contrib folder for
such stuff and I've to admit that the use for the bash completion is only
limited to a relatively small part of the LyX userbase.

comment:3 by ps@…, 16 years ago

Cc: ps@… added

it can be put into development/tools. i would be in favour of this but the
permission of the authors is needed (or rewrite needed).

comment:4 by sven@…, 16 years ago

Beside that fact that it's more or less a shell script I considered it to be a
configuration file. Looking around in the other completion files I can find some
of them state a licence some of them don't oh and some are a bit more complex. ;)

I'll write a mail to try to make it absolutely clear that it's free and
distributable.

comment:5 by sven@…, 16 years ago

Ok got a response from Julien who wrote the original file for inkscape:


Sven Hoexter wrote:

Hi Sven,

'do whatever you wan't to do with it'

:)

regards,

Julien.


So you can distribute it along with LyX.

comment:6 by Richard Heck, 15 years ago

Cc: rgheck@… added

Can we go ahead and add this somewhere?

And by the way, what am I, the lowly user, to do with this file?

comment:7 by ps@…, 15 years ago

there are two authors and we didn't get response from the second one.
imho writing our own script would demand less energy then all this licensing
stuff :)

comment:8 by sven@…, 15 years ago

Well it's at least derived from something within Debian, though that doesn't
give it an explizit license, I don't think there will be any problems. Beside
that I fail to see the creational high of those nowdays common helper scripts
for the bash completion but IANAL.

Richard: You maybe find an /etc/bash_completion.d/ directory on your system. If
yes simply copy the file there, restart your shell and you should be done.
If you don't have such a directory or cannot write to it simply source the file
from your .bashrc. Oh and you need some 3.x version of bash IIRC.

comment:9 by ps, 15 years ago

Priority: highlow

comment:10 by ps, 14 years ago

Description: modified (diff)
Milestone: 2.0.0

lets put it into 2.0 then.
i know nothing about completion stuff. is there some standard location for installing purposes or putting it into tarball is enough?

in reply to:  10 comment:11 by Cengiz Günay, 14 years ago

Cc: cengique@… added

Hello, responding to your call Sanda, yes, I am still around.

Replying to sanda:

lets put it into 2.0 then.
i know nothing about completion stuff. is there some standard location for installing purposes or putting it into tarball is enough?

As Sven mentioned in his last post above, the right place for it is under /etc/bash_completion.d/. It would be a good start to include it in the tarball, but modifying "make install" to put it in the right place would be even better. The Debian package maintainer may be some help here, too.

Having seen all the fuss about licensing for the first time, I really think it's not necessary for such a simple script. It basically follows the bash manual.

comment:12 by ps, 14 years ago

As Sven mentioned in his last post above, the right place for it is under /etc/bash_completion.d/

i see. here (gentoo) the completion files at /usr/share/bash-completion so apparently every distro has its own ways. i'll put it into tarball only.

Having seen all the fuss about licensing for the first time, I really think it's not necessary

yes, anyway your nod here was better ;)

comment:13 by ps, 14 years ago

Keywords: fixedintrunk added

r34001. from alpha2 it will be in scripts/ dir.

i dont use completion myself, but it may be possible to improve the script that it knows
possible exports (in 2.0 it would be pdf,pdf1,..,pdf4, ps, xhtml) and dbg levels is also fixed set.

in reply to:  12 comment:14 by Sven Hoexter, 14 years ago

Replying to sanda:

As Sven mentioned in his last post above, the right place for it is under /etc/bash_completion.d/

i see. here (gentoo) the completion files at /usr/share/bash-completion so apparently every distro has its own ways. i'll put it into tarball only.

Fedora seems to use the files and setup from Debian while RHEL 5 doesn't even ship with the basic bash-completion package.
Someone from the BSD world around? Oh wait they usually won't use bash. ;)

Anyway I'm perfectly fine with having it in the tarball. :)
Thanks Pavel

comment:15 by ps, 14 years ago

from release-notes to 2.0:

There is a new option

"--batch" that causes LyX to run the given commands without opening a GUI
window. Thus, something like:

lyx --batch -x "buffer-print printer default dvips" myfile.lyx

comment:16 by Sven Hoexter, 14 years ago

Looks like that's missing in the manpage aswell ...

comment:17 by ps, 14 years ago

fixed in r34004

comment:18 by Sven Hoexter, 14 years ago

So something like this should do the magic for the completion.

Index: bash_completion
===================================================================
--- bash_completion (Revision 34004)
+++ bash_completion (Arbeitskopie)
@@ -13,7 +13,7 @@

if "$cur" == -* ; then

COMPREPLY=( $( compgen -W '-help -userdir -sysdir \

-geometry -dbg -x --execute -e --export \

  • -i --import -version' -- $cur ) )

+ -i --import -version --batch' -- $cur ) )

else

_filedir '@(lyx)'

fi

BTW: Am I the only who thinks that the options are inconsistent?
Looks like lyx traditionally had some prefixed the unix way with only one dash and later on added longopts with double dashes and a one dash short. Now batch has a double dash without a short -b.

comment:19 by ps, 14 years ago

Am I the only who thinks that the options are inconsistent?

i was pondering about the same thing.

in reply to:  12 comment:20 by Cengiz Günay, 14 years ago

Replying to sanda:

yes, anyway your nod here was better ;)

I'm sorry guys. Going back, I saw Sven's email from '08. I must have been confused for the request for permission, since I was the one sent the file to you for inclusion. Sorry for not answering on time.

comment:21 by ps, 14 years ago

Looks like lyx traditionally had some prefixed the unix way

two ways:
either start using two dashes or change it for "-batch".
i prefer the second one because of not breaking already existing usage.

comment:22 by ps, 14 years ago

in reply to:  22 comment:23 by Sven Hoexter, 14 years ago

Replying to sanda:

r34005

sorry for nagging but now you forgot the manpage ...

comment:24 by ps, 14 years ago

:) thanks, fixed now.

btw Sven you might know how to properly fix #2820?

by Cengiz Günay, 14 years ago

Attachment: export-options.patch added

Patch for completing file names for --export and -e options.

in reply to:  13 comment:25 by Cengiz Günay, 14 years ago

Replying to sanda:

i dont use completion myself, but it may be possible to improve the script that it knows
possible exports (in 2.0 it would be pdf,pdf1,..,pdf4, ps, xhtml) and dbg levels is also fixed set.

I attached a patch for export possibilities. I wasn't sure what you came up with the --batch vs. -batch, so it is not included in the patch. also forgot to add the debug levels, but you could easily follow what I did to add that, too.

comment:26 by ps, 14 years ago

I attached a patch for export possibilities.

the patch is in, thanks.
(btw i had flash of this unusual name - haven't you been by chance in last year at cns meeting in berlin?)

in reply to:  26 comment:27 by Cengiz Günay, 14 years ago

Replying to sanda:

(btw i had flash of this unusual name - haven't you been by chance in last year at cns meeting in berlin?)

:) Small world! Yes, I was the Computational Neuroscience meeting. What's your full name? Send me an email if you will, so we don't go off topic cluttering the ticket.

by Cengiz Günay, 14 years ago

Attachment: debug-options.patch added

Patch to r34001 for adding comma-separated options to -dbg and added missing option -batch

comment:28 by Cengiz Günay, 14 years ago

Please test my new patch for the -dbg options!

I also added the -batch option because it's not the only inconsistent option: -help and -userdir also fall in the same category. So IMO, until they are changed, it would be fine to keep -batch as well.

I removed the reference to the inkscape completion file because I now heavily modified the code and added a lot of new stuff. I added a "copyleft" statement assuming that will prevent the licensing problems. Please advise if that's not the case.

Cheers.

comment:29 by ps, 14 years ago

Thanks, its in r34067.

comment:30 by ps, 13 years ago

Keywords: fixedintrunk removed
Resolution: fixed
Status: newclosed

2.0.0 is ready.

Note: See TracTickets for help on using tickets.