diff --git a/README.md b/README.md index 5651584..b00b317 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ If you want to have the latest git version, you can also install using the repos pip install git+https://github.com/bvanelli/actualpy.git ``` +For querying basic information, you additionally install the CLI, checkout the +[basic documentation](https://actualpy.readthedocs.io/en/latest/command-line-interface/) + # Basic usage The most common usage would be downloading a budget to more easily build queries. This would you could handle the diff --git a/actual/cli/config.py b/actual/cli/config.py index 4d73c3c..d3f8f56 100644 --- a/actual/cli/config.py +++ b/actual/cli/config.py @@ -13,7 +13,7 @@ def default_config_path(): - return Path.home() / ".actual" / "config.yaml" + return Path.home() / ".actualpy" / "config.yaml" class OutputType(Enum): diff --git a/docs/command-line-interface.md b/docs/command-line-interface.md new file mode 100644 index 0000000..2e1a52f --- /dev/null +++ b/docs/command-line-interface.md @@ -0,0 +1,48 @@ +# Command line interface + +You can try out `actualpy` directly without the need if writing a custom script. All you need to do is install the +command line interface with: + +```bash +pip install "actualpy[cli]" +``` + +You should then be able to generate exports directly: + +```console +$ actualpy init +Please enter the URL of the actual server [http://localhost:5006]: +Please enter the Actual server password: +(1) Test +Please enter the budget index: 1 +Name of the context for this budget [test]: +Initialized budget 'test' +$ actualpy export +Exported budget 'Test' (budget id 'My-Finances-0b46239') to '2024-10-04-1438-Test.zip'. +``` + +The configuration will be saved on the folder `.actualpy/config.yaml`. Check full help for more details: + +```console +$ actualpy --help + + Usage: actualpy [OPTIONS] COMMAND [ARGS]... + +╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ --output -o [table|json] Output format: table or json [default: table] │ +│ --install-completion Install completion for the current shell. │ +│ --show-completion Show completion for the current shell, to copy it or customize the installation. │ +│ --help Show this message and exit. │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ accounts Show all accounts. │ +│ export Generates an export from the budget (for CLI backups). │ +│ init Initializes an actual budget config interactively if options are not provided. │ +│ metadata Displays all metadata for the current budget. │ +│ payees Show all payees. │ +│ remove-context Removes a configured context from the configuration. │ +│ transactions Show all transactions. │ +│ use-context Sets the default context for the CLI. │ +│ version Shows the library and server version. │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +``` diff --git a/tests/test_cli.py b/tests/test_cli.py index 6c048c8..3635e4e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -87,7 +87,7 @@ def test_init_interactive(actual_server, mocker): def test_load_config(actual_server): cfg = Config.load() assert cfg.default_context == "test" - assert str(default_config_path()).endswith(".actual/config.yaml") + assert str(default_config_path()).endswith(".actualpy/config.yaml") # if the context does not exist, it should fail to load the server cfg.default_context = "foo" with pytest.raises(ValueError, match="Could not find budget with context"):