diff --git a/zulip/setup.py b/zulip/setup.py index 0e9ebfa..c8b860f 100755 --- a/zulip/setup.py +++ b/zulip/setup.py @@ -59,6 +59,7 @@ package_info = dict( entry_points={ 'console_scripts': [ 'zulip-send=zulip.send:main', + 'zulip-api-examples=zulip.api_examples:main' ], }, ) # type: Dict[str, Any] diff --git a/zulip/zulip/api_examples.py b/zulip/zulip/api_examples.py new file mode 100644 index 0000000..67a9da1 --- /dev/null +++ b/zulip/zulip/api_examples.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import zulip + +def main(): + zulip_path = os.path.abspath(os.path.dirname(zulip.__file__)) + examples_path = os.path.abspath(os.path.join(zulip_path, 'examples')) + if os.path.isdir(examples_path): + print(examples_path) + else: + raise OSError("Examples cannot be accessed at {}: Directory does not exist!" + .format(examples_path)) + +if __name__ == '__main__': + main()