# ThingsPrompt
Shell client for ThingsDB.
## Installation
Using pip:
```shell
pip install thingsprompt
```
Or, clone this project and use the setup
```shell
python setup.py install
```
## Example usage
```shell
things-prompt -n localhost -u admin -p pass
127.0.0.1:9200 (@thingsdb)> new_collection('my_collection');
127.0.0.1:9200 (@thingsdb)> @:my_collection
127.0.0.1:9200 (@:my_collection)> .greet = "Hello world!";
"Hello world!"
```
> For users encountering issues executing the `things-prompt` command due to the script directory not being included in their system's PATH environment variable, an alternative invocation method exists. Users can bypass the PATH requirement by directly invoking the module via `python -m thingsprompt` (note the lack of hyphen). This approach is particularly advantageous in scenarios where multiple Python environments host thingsprompt installations, and precise environment selection is crucial.
## Example import/export
```shell
# Export the "stuff" collection to a filename
things-prompt -n localhost -u admin -p pass -s //stuff export /tmp/dump.mp
# Import the file into a new collection "clone"
# ThingsDB prompt will automatically create the collection if it does not exist
things-prompt -n localhost -u admin -p pass -s //clone import /tmp/dump.mp
```
## Help
```
usage: things-prompt [-h] [--node NODE] [--port PORT] [--user USER]
[--password PASSWORD] [--token TOKEN] [--scope SCOPE]
[--timeout TIMEOUT] [--ssl] [--hide-connection-info]
[--style {dracula,monokai,colorful,friendly,vim,none}]
[--version]
{export,import} ...
positional arguments:
{export,import} sub-command help
export export a collection to file
import import a collection from file
optional arguments:
-h, --help show this help message and exit
--node NODE, -n NODE node address
--port PORT TCP port where the node is listening on for API calls
--user USER, -u USER user name
--password PASSWORD, -p PASSWORD
password, will be prompted if not given
--token TOKEN, -t TOKEN
token key
--scope SCOPE, -s SCOPE
set the initial scope
--timeout TIMEOUT connect and query timeout in seconds
--ssl enable secure connection (SSL/TLS)
--hide-connection-info
no address and port info in prompt
--style {dracula,monokai,colorful,friendly,vim,none}
syntax highlighting style or none for disabled
--version print version and exit
```
### Help export
```
usage: things-prompt export [-h] [--structure-only] filename
positional arguments:
filename filename to store the export
optional arguments:
-h, --help show this help message and exit
--structure-only generates a textual export with only enumerators, types
and procedures; without this argument the export is not
readable but in MessagePack format and intended to be used
for import
```
### Help import
```
usage: things-prompt import [-h] [--tasks] filename
positional arguments:
filename filename to import; can be ThingsDB code (*.ti) or a binary export (*.mp)
optional arguments:
-h, --help show this help message and exit
--tasks include tasks when importing a collection
```
## Special commands
command | description
---------------|----------------------
`?` | Show help.
`@scope` | Switch to another scope, for example: `@:stuff`
`@scope query` | Run a single query in a given scope, for example `@n node_info();`
`CTRL + n` | Insert a new line
Raw data
{
"_id": null,
"home_page": "https://github.com/thingsdb/ThingsPrompt",
"name": "thingsprompt",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "database connector prompt thingsdb",
"author": "Jeroen van der Heijden",
"author_email": "jeroen@cesbit.com",
"download_url": "https://files.pythonhosted.org/packages/cb/6c/25f356c7987462990899104aa9c7d40e89996c66d34e15f7613f3c356a3f/thingsprompt-1.0.10.tar.gz",
"platform": null,
"description": "# ThingsPrompt\n\nShell client for ThingsDB.\n\n\n## Installation\n\nUsing pip:\n\n```shell\npip install thingsprompt\n```\n\nOr, clone this project and use the setup\n\n```shell\npython setup.py install\n```\n\n## Example usage\n\n```shell\nthings-prompt -n localhost -u admin -p pass\n\n\n127.0.0.1:9200 (@thingsdb)> new_collection('my_collection');\n127.0.0.1:9200 (@thingsdb)> @:my_collection\n127.0.0.1:9200 (@:my_collection)> .greet = \"Hello world!\";\n\n\"Hello world!\"\n```\n\n> For users encountering issues executing the `things-prompt` command due to the script directory not being included in their system's PATH environment variable, an alternative invocation method exists. Users can bypass the PATH requirement by directly invoking the module via `python -m thingsprompt` (note the lack of hyphen). This approach is particularly advantageous in scenarios where multiple Python environments host thingsprompt installations, and precise environment selection is crucial.\n\n## Example import/export\n\n```shell\n# Export the \"stuff\" collection to a filename\nthings-prompt -n localhost -u admin -p pass -s //stuff export /tmp/dump.mp\n\n# Import the file into a new collection \"clone\"\n# ThingsDB prompt will automatically create the collection if it does not exist\nthings-prompt -n localhost -u admin -p pass -s //clone import /tmp/dump.mp\n```\n\n## Help\n\n```\nusage: things-prompt [-h] [--node NODE] [--port PORT] [--user USER]\n [--password PASSWORD] [--token TOKEN] [--scope SCOPE]\n [--timeout TIMEOUT] [--ssl] [--hide-connection-info]\n [--style {dracula,monokai,colorful,friendly,vim,none}]\n [--version]\n {export,import} ...\n\npositional arguments:\n {export,import} sub-command help\n export export a collection to file\n import import a collection from file\n\noptional arguments:\n -h, --help show this help message and exit\n --node NODE, -n NODE node address\n --port PORT TCP port where the node is listening on for API calls\n --user USER, -u USER user name\n --password PASSWORD, -p PASSWORD\n password, will be prompted if not given\n --token TOKEN, -t TOKEN\n token key\n --scope SCOPE, -s SCOPE\n set the initial scope\n --timeout TIMEOUT connect and query timeout in seconds\n --ssl enable secure connection (SSL/TLS)\n --hide-connection-info\n no address and port info in prompt\n --style {dracula,monokai,colorful,friendly,vim,none}\n syntax highlighting style or none for disabled\n --version print version and exit\n```\n### Help export\n\n```\nusage: things-prompt export [-h] [--structure-only] filename\n\npositional arguments:\n filename filename to store the export\n\noptional arguments:\n -h, --help show this help message and exit\n --structure-only generates a textual export with only enumerators, types\n and procedures; without this argument the export is not\n readable but in MessagePack format and intended to be used\n for import\n```\n\n### Help import\n\n```\nusage: things-prompt import [-h] [--tasks] filename\n\npositional arguments:\n filename filename to import; can be ThingsDB code (*.ti) or a binary export (*.mp)\n\noptional arguments:\n -h, --help show this help message and exit\n --tasks include tasks when importing a collection\n```\n\n## Special commands\n\ncommand | description\n---------------|----------------------\n`?` | Show help.\n`@scope` | Switch to another scope, for example: `@:stuff`\n`@scope query` | Run a single query in a given scope, for example `@n node_info();`\n`CTRL + n` | Insert a new line\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "ThingsDB Prompt",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/thingsdb/ThingsPrompt"
},
"split_keywords": [
"database",
"connector",
"prompt",
"thingsdb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cb6c25f356c7987462990899104aa9c7d40e89996c66d34e15f7613f3c356a3f",
"md5": "0c41c6d1b66b43f6f033fb1d4d6291cd",
"sha256": "e157f524b09c6b0171c5d0d4152d1ccfcf30ae0852f0e511ed678c68f5ebfa9f"
},
"downloads": -1,
"filename": "thingsprompt-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "0c41c6d1b66b43f6f033fb1d4d6291cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23216,
"upload_time": "2024-04-15T12:24:59",
"upload_time_iso_8601": "2024-04-15T12:24:59.018651Z",
"url": "https://files.pythonhosted.org/packages/cb/6c/25f356c7987462990899104aa9c7d40e89996c66d34e15f7613f3c356a3f/thingsprompt-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-15 12:24:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thingsdb",
"github_project": "ThingsPrompt",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "setproctitle",
"specs": []
},
{
"name": "python-thingsdb",
"specs": [
[
">=",
"1.1.1"
]
]
},
{
"name": "prompt-toolkit",
"specs": [
[
">=",
"3.0.43"
]
]
},
{
"name": "pygments",
"specs": [
[
">=",
"2.17.2"
]
]
}
],
"lcname": "thingsprompt"
}