anyr
List, search, and manipulate anytype objects from the command-line
Homepage: https://github.com/stevelr/anytype
# show options
# check authentication status (HTTP + gRPC)
# authenticate with desktop and http endpoint
# List spaces your user is authorized to access
# List Pages in space "Work"
# List Files in a space (requires gRPC credentials)
# Download/upload file bytes
# use `--dir DIR` to set download dir, or `--file PATH` for destination file path
# Get chat messages from space "Chat"
# Post message
Common options
These options apply to most commands.
Examples
List objects in a space
# List <ENTITY> in a space. (entities: object, member, property, template)
# anyr <ENTITY> list <SPACE_ID_OR_NAME>
# list objects in space 'Personal'
# list types in space 'Personal'
Search in space
# search space "Work" for tasks containing the text "customer"
List tasks in space
space="Work" # specify space using name or id
for
Find files
# list images in space Personal, larger than 1MB with a name containing "report"
# list pdf or docx files in space Personal
List items in query or collection
# list queries in space. "$space" can be id ("bafy...") or name ("Projects")
# list collections in the space
# from above, get id of query or collection of interest, then
# list items in query or collection, in view "All"
Get objects from a collection list or grid view
# show names of all tasks in space "Work", using view 'All'
# show columns: Name, Created By, and Status (note: column names are specified by property_key)
# get tasks from view ByProject in json, with all properties
If you have a list or grid formatted view, you can use view objects to list the view items by specifying the space name, list, and view.
- Results are filtered and sorted by the criteria in the view.
- View can be specified by the view id or view name.
- The --json and --pretty format outputs include all properties of the objects.
Table listing features for view objects:
- Table listing defaults to name column only. Specify columns in table output with
--cols/--columnsand a comma-separated list of property keys. Example--cols name,creator,created_date,status - Format dates with strftime format:
--date-formatorANYTYPE_DATE_FORMAT, defaults to%Y-%m-%d %H:%M:%S. - Members names are displayed instead of member id.
Chat order ids
Chat message order ids are converted to lowercase hex before display in table-format output, to make them easier to read and type, while preserving lexicographic order. Any argument that accepts an order id also accepts the hex form. Example: the order id !!@, is displayed as 2121402c, and you can pass 2121402c back to commands that accept an order id.
Install
Release binaries are on github
Macos via Homebrew
Linux (arm64/x86_64)
|
Windows Powershell
|
Cargo
Build from source
Cargo
Requirements:
- protoc (from the protobuf package) in your PATH. On macos,
brew install protobuf - libgit2 in your library path.
Nix
Configure
Configuration can be set with command-line parameters or environment variables.
-
Url The default url is the desktop client
http://127.0.0.1:31009. Override with--urlor the environment variableANYTYPE_URL. -
Key Storage The default key storage method should work on most platforms. Options for overriding the defaults are described below in Key storage.
# use headless server and custom key path
Generating and saving credentials
-
Desktop: If the Anytype desktop app is running, type
anyr auth loginand the app will display a 4-digit code. Enter the code into the anyr prompt, and a key is generated and stored in the KeyStore. -
Headless server: If you are using the headless cli server, start the server, run
anytype auth apikey create anyrto generate and display a key, then either:- paste it into
anyr auth set-http(reads from stdin), or - save it in a file and set the key file path as described in Key storage.
- paste it into
See anytype README.md for more info, and the helper script init-cli-keys.sh for generating and saving http and gRPC credentials.
Logging
Debug logging
RUST_LOG=debug
Log HTTP requests and responses:
RUST_LOG=warn,anytype::http_json=trace
Testing
Python CLI tests expect the same environment variables as the API tests:
ANYTYPE_TEST_URL(orANYTYPE_URL)ANYTYPE_TEST_KEY_FILE(orANYTYPE_KEY_FILE)ANYTYPE_TEST_SPACE_ID
License
Apache License, Version 2.0