[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
python-ly, ly.indent
From: |
mason |
Subject: |
python-ly, ly.indent |
Date: |
Fri, 16 Aug 2019 18:00:47 -0700 |
User-agent: |
NeoMutt/20180716-346-437793-dirty |
Hi all,
The command line tools provided by python-ly are very
convenient and easy to use, but I'm finding it a little harder to wrap
my head around the Python module.
For example, it is easy to automatically indent a file with
$ ly "indent" file.ly
or to indent the output of another command such as
$ cat file.ly | ly "indent"
I'd like to be able to do something similar in Python, using ly.indent
to indent files or (preferably) strings. It seems that ly.indent might
be what I want, but I'm having trouble figuring out how it works. The
Indenter() class, with an indent() function, is defined here,[1] but I'm
don't understand what a cursor object is or how to create and pass one.
I next tried looking through Frescobaldi's code for example usage and
found this,[2] but I think I would need to learn more about how
Frescobaldi works in order to follow what's happening, which is deeper
than I want to go to indent a string of Lilypond code.
Is there a simple way to use ly.indent similarly to `ly "indent"`, or
would I be better off invoking `ly "indent"` externally with
os.system()?
Thanks,
Mason
[1]
https://github.com/frescobaldi/python-ly/blob/0d91ca2450ba01a8158f53ba05202af3e13bf78d/ly/indent.py
[2]
https://github.com/frescobaldi/frescobaldi/blob/09cae764126b505dedf0182beccd78d7934b2de4/frescobaldi_app/indent.py
signature.asc
Description: PGP signature
- python-ly, ly.indent,
mason <=
- Re: python-ly, ly.indent, Urs Liska, 2019/08/17
- Re: python-ly, ly.indent, mason, 2019/08/17
- Re: python-ly, ly.indent, Urs Liska, 2019/08/17
- Re: python-ly, ly.indent, mason, 2019/08/17
- Re: python-ly, ly.indent, Urs Liska, 2019/08/17
- frescobaldi extensions [was: python-ly, ly.indent], mason, 2019/08/17
- Re: frescobaldi extensions [was: python-ly, ly.indent], Urs Liska, 2019/08/18
- Re: frescobaldi extensions [was: python-ly, ly.indent], Wols Lists, 2019/08/18
- Re: frescobaldi extensions [was: python-ly, ly.indent], mason, 2019/08/19