Skip to main content

Gather information about Sublime Text

Project description

Build Status

Gather information about Sublime Text

This was built for the Sublime plugin tests framework. It provides a cross-platform way to collect data about Sublime Text without running Sublime Text (necessary for creating a plugin harness to Sublime Text).

Currently, only Linux is supported but OSX and Windows support are planned.

Getting Started

Install the module with: pip install sublime_info

import sublime_info
sublime_info.get_sublime_path()  # /usr/bin/subl
sublime_info.get_sublime_version()  # 3083
sublime_info.get_package_directory()  # /home/todd/.config/sublime-text-2/Packages

Documentation

sublime_info provides 3 top level functions for your consumption.

get_sublime_path

sublime_info.get_sublime_path()
"""Resolve Sublime Text path (e.g. /usr/bin/subl)

If ``SUBLIME_TEXT_PATH`` is provided via environment variables, it will be used.
Otherwise, a ``which``-like resolution will be returned.

:raises STNotFoundError: If Sublime Text cannot be found, an error will be raised.
:returns: ``SUBLIME_TEXT_PATH`` or ``which``-like resolution
:rtype: str
"""

get_sublime_version

sublime_info.get_sublime_version()
"""Resolve Sublime Text version (e.g. 2221, 3083)

Sublime Text is resolved via ``get_sublime_path``

:raises Exception: If the Sublime Text version cannot be parsed, an error will be raised.
:returns: Version of Sublime Text returned by ``sublime_text --version``.
:rtype: int
"""

get_package_directory

sublime_info.get_package_directory()
"""Resolve Sublime Text package directory (e.g. /home/todd/.config/sublime-text-2/Packages)

:raises Exception: If the Sublime Text version is not recognized, an error will be raised.
:returns: Path to Sublime Text's package directory
:rtype: str
"""

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test via ./test_linux.sh.

Donating

Support this project and others by twolfson via gittip.

Support via Gittip

Unlicense

As of Oct 14 2013, Todd Wolfson has released this repository and its contents to the public domain.

It has been released under the UNLICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

sublime_info-0.2.0.zip (12.2 kB view hashes)

Uploaded Source

sublime_info-0.2.0.tar.gz (5.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page