@flagment-dev/cli (英语)
断裂 是移动资金的工程师的编目API。 停止扭曲支付表,调试平衡错误并黑入数据管道. 开始运输能带来变化的特性.
安装
在macOS(苹果硅或英特尔)或用glibc的Linux x64上安装.
要求数 节点.js 18或以后 打开 PATH数字 :
curl -fsSL https://fragment.dev/install.sh | sh
安装者在下载 JavaScript 唯一的 CLI 存档之前检查节点.
如果节点缺失或不支持,则在安装引导下退出.
它不需要npm,Homebrew,或sudo.
发射装置使用安装时所选择的节点可执行文件.
如果您移动或删除了节点可执行文件, 则重放安装器 .
它装入 ~/.local/share/fragment 创建 ~/.local/bin/fragment。 。 。 .
如果目录没有显示, 立即使用打印的可执行路径 PATH。 。 。 .
将目录添加到您未来会话的 shell 配置 .
其他地点的现有证书和设施仍然可用.
安装者拒绝覆盖它不管理的现有可执行文件 .
或者,安装 npm :
npm install -g @fragment-dev/cli
或者安装在 土生土长数字 :
brew tap fragment-dev/tap
brew install fragment-dev/tap/fragment-cli
运行 fragment update 升级。 将卷轴安装或回滚固定:
curl -fsSL https://fragment.dev/install.sh | sh -s -- --version <version>
使用 --install-dir <absolute-path> 财务报告和审定财务报表 --bin-dir <absolute-path> 以选择安装位置.
旧版本仍然保留在安装目录中,这样运行的命令可以在更新时完成.
图标
新用户浏览器登录
运行 fragment login --browser 以签名并选择工作空间.
仪表板在请您批准 API- 客户端创建之前, 发现了选定的工作空间区域 .
新用户先完成仪表板上载.
浏览器和CLI必须在同一台机器上运行.
取消授权停止CLI登录,并在浏览器中显示确认. 运行 fragment login --browser 再次尝试.
使用 --workspace <id> 以直接选择一个已有的工作空间.
全权证书留在CLI证书目录中。 浏览器在提供后显示确认,并带有打开所批准的工作空间的按钮.
打印本地计划
运行 fragment print-schema --path ./fragment.jsonc 来查看账户和条目的图表.
使用 --account <name-or-path> 或者说 --entry <name> ;这些旗帜不能合并.
账户选择器接受打印的模板占位符和实例标识符,例如 liabilities/customer:{{customer_id}} 或者说 liabilities/customer:123。 。 。 .
不认证支持JSON和JSONC文件.
模拟一个情景
运行 fragment simulate-scenario --path ./fragment.jsonc --scenario "Customer payment" --step 1 在设想阶段后查看平衡.
步骤从 1 开始; 不允许步骤 0 。 计划的最后一场活动以外的步骤被拒绝.
输出列出所有情景条目并用QQ来标记所选条目.
通过选定的步骤输入带有账户类型平方和格式化的寄出金额的账户路径.
后步只显示其入门名.
账户余额使用图表的框字符并嵌入,每个账户密钥后有余额.
父母的平衡包括其子女。 未用情景账户省略.
以后步骤使用的账户在登录前仍为零。 模板实例在结肠后显示其实际的ID.
余额包括按账户和货币分类的通过选定步骤的入帐。 余额使用每种货币的精度和逗号分隔符,在账户后置于方括号内.
一个失败的条目报告其步骤和原因,而不是打印余额 .
JSON和JSONC文件在没有认证的情况下得到支持.
fragment add-ledger-entryfragment api-client createfragment autocomplete [SHELL]fragment commandsfragment create-custom-linkfragment create-ledgerfragment delete-custom-txsfragment delete-ledgerfragment delete-schemafragment gen-graphqlfragment get-schemafragment help [COMMAND]fragment initfragment loginfragment migrate-ledger-entryfragment print-schemafragment query ledgerAccountsfragment query ledgersfragment query schemafragment query schemasfragment reverse-ledger-entryfragment simulate-scenariofragment startfragment store-schemafragment tokenfragment updatefragment update-ledger-accountfragment verify-schemafragment versionfragment workspace
fragment add-ledger-entry
添加一个编目到编目账户.
USAGE
$ fragment add-ledger-entry -i <value> -l <value> -t <value> [-v] [-n <value>] [-p <value>...]
FLAGS
-i, --ik=<value> (required) The Idempotency Key for Ledger Entry creation.
-l, --ledger.ik=<value> (required) The Idempotency Key of the Ledger to post the Ledger Entry to.
-n, --type.version=<value> The version of the Ledger Entry type you want to post.
-p, --param=<value>... The parameters for your Ledger Entry. (ex: --param amount=100 --param currency=USD)
-t, --type=<value> (required) The `type` of Ledger Entry you want to post.
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Add a Ledger Entry to a Ledger Account.
This mirrors the addLedgerEntry mutation in the GraphQL API.
Only entries with type are allowed to be posted to a Ledger Account.
EXAMPLES
$ fragment add-ledger-entry
FLAG DESCRIPTIONS
-p, --param=<value>... The parameters for your Ledger Entry. (ex: --param amount=100 --param currency=USD)
You may specify multiple parameters by repeating the flag.
fragment api-client create
为整合创建 API 客户端 .
USAGE
$ fragment api-client create --workspace <value> --name <value> [--role admin|reader] [--output <value>] [--format
json|env]
FLAGS
--format=<option> [default: json] Output format (applies to both stdout and --output).
<options: json|env>
--name=<value> (required) A display name for the API client.
--output=<value> Write the credentials to this file instead of stdout.
--role=<option> Role to assign the API client (defaults to your own role, capped at it).
<options: admin|reader>
--workspace=<value> (required) The Workspace id to create the API client in.
DESCRIPTION
Create an API client for an integration.
Authenticates in the browser and provisions a new API client for the
given Workspace, then writes the credentials to a file or stdout. The
authorizing user must have permission to create API clients.
EXAMPLES
$ fragment api-client create --workspace <workspace-id> --name "Billing service" --role reader
$ fragment api-client create --workspace <workspace-id> --name CI --output ./fragment-client.json
fragment autocomplete [SHELL]
显示自动完成安装指令 .
USAGE
$ fragment autocomplete [SHELL] [-r]
ARGUMENTS
[SHELL] (zsh|bash|powershell) Shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
Display autocomplete installation instructions.
EXAMPLES
$ fragment autocomplete
$ fragment autocomplete bash
$ fragment autocomplete zsh
$ fragment autocomplete powershell
$ fragment autocomplete --refresh-cache
参见代码 : @oclif/ plugin- auto 完成
fragment commands
列出所有片段命令 .
USAGE
$ fragment commands [--json] [-c id|plugin|summary|type... | --tree] [--deprecated] [-x | ] [--hidden]
[--no-truncate | ] [--sort id|plugin|summary|type | ]
FLAGS
-c, --columns=<option>... Only show provided columns (comma-separated).
<options: id|plugin|summary|type>
-x, --extended Show extra columns.
--deprecated Show deprecated commands.
--hidden Show hidden commands.
--no-truncate Do not truncate output.
--sort=<option> [default: id] Property to sort by.
<options: id|plugin|summary|type>
--tree Show tree of commands.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List all fragment commands.
参见代码 : @ oclif/ 插件命令
fragment create-custom-link
创建自定义链接
USAGE
$ fragment create-custom-link -i <value> --name <value> [-v]
FLAGS
-i, --ik=<value> (required) The Idempotency Key for the Custom Link creation.
-v, --verbose Enable verbose mode (prints GraphQL commands).
--name=<value> (required) The name for the Custom Link.
DESCRIPTION
Create a Custom Link
This mirrors the CreateCustomLink API endpoint.
Read https://fragment.dev/docs/sync-payments#custom-link-onboarding to learn more about Custom Links.
EXAMPLES
$ fragment create-custom-link --ik <ik> --name <name>
fragment create-ledger
在您碎片工作空间内创建有计划编程器
USAGE
$ fragment create-ledger -i <value> -n <value> [-v] [-s <value>]
FLAGS
-i, --ik=<value> (required) Idempotency key for Ledger creation
-n, --name=<value> (required) Ledger name (e.g. 'My First Ledger')
-s, --schema=<value> [default: fragment.jsonc] Path to schema file (defaults to fragment.jsonc)
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Create schematized Ledger within your Fragment workspace
EXAMPLES
$ fragment create-ledger
fragment delete-custom-txs
删除自定义 Txs .
USAGE
$ fragment delete-custom-txs --id <value>... [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
--id=<value>... (required) Fragment ID of the Custom Tx to delete.
DESCRIPTION
Delete Custom Txs.
This mirrors the deleteCustomTxs mutation in the GraphQL API.
EXAMPLES
$ fragment delete-custom-txs
fragment delete-ledger
删除一个编目.
USAGE
$ fragment delete-ledger [-v] [-l <value>] [--ledger.id <value>]
FLAGS
-l, --ledger.ik=<value> The Idempotency Key of the Ledger to delete.
-v, --verbose Enable verbose mode (prints GraphQL commands).
--ledger.id=<value> The Fragment ID of the Ledger to delete.
DESCRIPTION
Delete a Ledger.
This mirrors the deleteLedger mutation in the GraphQL API.
EXAMPLES
$ fragment delete-ledger
fragment delete-schema
删除一个Schema.
USAGE
$ fragment delete-schema -k <value> [-v]
FLAGS
-k, --key=<value> (required) Key of the Schema to delete (e.g. template-schema).
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Delete a Schema.
This mirrors the deleteSchema mutation in the GraphQL API.
EXAMPLES
$ fragment delete-schema
fragment gen-graphql
生成您 Schema 的 GraphQL 查询 .
USAGE
$ fragment gen-graphql -p <value> -o <value> [--output-file-per-query] [--include-standard-queries]
[--include-runtime-args]
FLAGS
-o, --output=<value> (required) The output path for the generated file(s). Must end with .graphql or .gql,
unless --output-file-per-query is set. If set, the output path must be a directory.
-p, --path=<value> (required) The path to the schema file.
--include-runtime-args Include tags, groups, and conditions (when not defined in the Schema) as arguments in
the generated GraphQL queries.
--include-standard-queries Include the set of standard queries in the output. This is required only if you are
not using the Fragment SDK.
--output-file-per-query Output each query in a separate file instead of a single file.
DESCRIPTION
Generate GraphQL queries from your Schema for your SDK.
This command generates a GraphQL query for each Ledger Entry type and each Payment type in your ledger Schema.
Use this command with Fragment SDKs to create type-safe code to update your ledger.
EXAMPLES
Output the GraphQL queries from the schema file at <path>.
$ fragment gen-graphql --path <path>
Output the GraphQL queries to a specific output path.
$ fragment gen-graphql --path <path> --output <output path>
Output each GraphQL query in a separate file.
$ fragment gen-graphql --path <path> --output <output path> --output-file-per-query
Include the standard GraphQL queries and output each in a separate file.
$ fragment gen-graphql --path <path> --output <output path> --output-file-per-query --include-standard-queries
fragment get-schema
从 API 获取一个方案供本地使用
USAGE
$ fragment get-schema [-v] [-k <value>] [--version <value>] [-o <value>]
FLAGS
-k, --key=<value> Key of schema (e.g. template-schema)
-o, --output=<value> Path to the schema file (e.g. /home/user/code/schema.jsonc). Defaults to the current directory
and the schema key as the file name.
-v, --verbose Enable verbose mode (prints GraphQL commands).
--version=<value> Schema version to retrieve (e.g. 2). Defaults to latest available version.
DESCRIPTION
Retrieve a schema from the API for local use
EXAMPLES
$ fragment get-schema
fragment help [COMMAND]
显示碎片的帮助 .
USAGE
$ fragment help [COMMAND...] [-n]
ARGUMENTS
[COMMAND...] Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for fragment.
参见代码 : @oclif/plugin-帮助
fragment init
初始化本地账户示例图表
USAGE
$ fragment init [-f <value>]
FLAGS
-f, --file=<value> [default: fragment.jsonc] Path to write initial schema to
DESCRIPTION
Initialize an example chart of accounts locally
EXAMPLES
$ fragment init
fragment login
认证与FRAGMENT.
USAGE
$ fragment login [--browser] [--workspace <value>] [--client-id <value>] [--client-secret <value>]
[--api-url <value>] [--oauth-url <value>] [--oauth-scope <value>] [--test]
FLAGS
--api-url=<value> The API URL for your FRAGMENT Workspace (ex: https://api.us-west-2.fragment.dev/graphql)
--browser Authenticate in the browser and provision an API client automatically.
--client-id=<value> The API Client ID for your FRAGMENT Workspace.
--client-secret=<value> The API Client Secret for your FRAGMENT Workspace
--oauth-scope=<value> The OAuth Scope for your auth token (ex: https://api.us-west-2.fragment.dev/*)
--oauth-url=<value> The OAuth URL from which to retrieve your auth token (ex:
https://auth.fragment.dev/oauth2/token)
--test If set, tests stored credentials only
--workspace=<value> The Workspace id. Omit to select a workspace after browser login.
DESCRIPTION
Authenticate with FRAGMENT.
Authentication is scoped to one FRAGMENT Workspace.
If you want to authenticate with another Workspace, you must create another API Client and follow the authentication
flow again.
Credentials will be written to ~/.fragment/auth.json.
EXAMPLES
$ fragment login
$ fragment login --browser --workspace <workspace-id>
$ fragment login --client-id <client-id> --client-secret <client-secret> --api-url <api-url> --oauth-url <oauth-url>
fragment migrate-ledger-entry
将一个编目条目移入新类型和版本.
USAGE
$ fragment migrate-ledger-entry -e <value> -l <value> -t <value> [-v] [-n <value>] [-p <value>...]
FLAGS
-e, --entry.id=<value> (required) The ID of the Ledger Entry to migrate.
-l, --ledger.ik=<value> (required) The Idempotency Key of the Ledger containing the entry.
-n, --new.entry.type.version=<value> The new version of the Ledger Entry type.
-p, --param=<value>... The parameters for the new Ledger Entry. (ex: --param amount=100 --param
currency=USD)
-t, --new.entry.type=<value> (required) The new type for the migrated Ledger Entry.
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Migrate a Ledger Entry to a new type and version.
This mirrors the migrateLedgerEntry mutation in the GraphQL API.
Migrates an existing Ledger Entry to a new type and version with new parameters.
EXAMPLES
$ fragment migrate-ledger-entry
FLAG DESCRIPTIONS
-p, --param=<value>... The parameters for the new Ledger Entry. (ex: --param amount=100 --param currency=USD)
You may specify multiple parameters by repeating the flag.
fragment print-schema
将账户和条目的图表在本地图中打印
USAGE
$ fragment print-schema [-p <value>] [--account <value> | --entry <value>]
FLAGS
-p, --path=<value> [default: fragment/fragment.json] Path to a schema JSON or JSONC file
--account=<value> Show one account by name, key, or full path
--entry=<value> Show an entry type and its versions, including posting lines
DESCRIPTION
Pretty-print the chart of accounts and entries in a local schema
EXAMPLES
$ fragment print-schema --path ./fragment.jsonc
$ fragment print-schema --path ./fragment.jsonc --account assets/cash
$ fragment print-schema --account "Cash"
$ fragment print-schema --entry carrier_paid
fragment query ledgerAccounts
在工作空间中通过身份获取分类账
USAGE
$ fragment query ledgerAccounts -l <value> [-v] [--first <value>] [--after <value>]
FLAGS
-l, --ledger=<value> (required) Ledger ID to retrieve accounts for
-v, --verbose Enable verbose mode (prints GraphQL commands).
--after=<value> Cursor to paginate through ledger accounts
--first=<value> Number of ledger accounts to retrieve in each page
DESCRIPTION
Get accounts for ledger within your workspace by ID
EXAMPLES
$ fragment query ledgerAccounts
fragment query ledgers
列出工作空间中的所有分类账
USAGE
$ fragment query ledgers [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
List all ledgers in your workspace
EXAMPLES
$ fragment query ledgers
fragment query schema
按键从工作空间获取计划
USAGE
$ fragment query schema -k <value> [-v] [--version <value>]
FLAGS
-k, --key=<value> (required) Key of schema (e.g. template-schema)
-v, --verbose Enable verbose mode (prints GraphQL commands).
--version=<value> Schema version to retrieve (e.g. 2). Defaults to latest available version.
DESCRIPTION
Get schema from your workspace by key
EXAMPLES
$ fragment query schema
fragment query schemas
列出您工作空间中的所有计划
USAGE
$ fragment query schemas [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
List all schemas in your workspace
EXAMPLES
$ fragment query schemas
fragment reverse-ledger-entry
倒置一个编目条目.
USAGE
$ fragment reverse-ledger-entry --id <value> [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
--id=<value> (required) Fragment ID of the Ledger Entry to reverse.
DESCRIPTION
Reverse a Ledger Entry.
This mirrors the reverseLedgerEntry mutation in the GraphQL API.
EXAMPLES
$ fragment reverse-ledger-entry
fragment simulate-scenario
假设情况步骤后模拟账户余额
USAGE
$ fragment simulate-scenario --scenario <value> --step <value> [-p <value>]
FLAGS
-p, --path=<value> [default: fragment/fragment.json] Path to a schema JSON or JSONC file
--scenario=<value> (required) Scenario name from the schema
--step=<value> (required) Step to include (1-based). Step 0 is not allowed
DESCRIPTION
Simulate account balances after a scenario step
EXAMPLES
$ fragment simulate-scenario --path ./fragment.jsonc --scenario "Customer payment" --step 1
fragment start
本地开发您的账户图表
USAGE
$ fragment start [-p <value>] [-f <value>] [--websocket-port <value>]
FLAGS
-f, --file=<value> [default: fragment.jsonc] Path for schema JSON file. Default to fragment.jsonc
-p, --port=<value> [default: 9410] Port for schema visualizer to run on
--websocket-port=<value> Port for the websocket to live on that syncs changes between the CLI and visualizer
DESCRIPTION
Develop your chart of accounts locally
EXAMPLES
$ fragment start --file ./my-fragment-schema.json
fragment store-schema
将计划存储在碎片工作空间
USAGE
$ fragment store-schema [-v] [-p <value>]
FLAGS
-p, --path=<value> [default: fragment.jsonc] Path to schema file (e.g. fragment.jsonc)
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Store schema within your Fragment workspace
EXAMPLES
$ fragment store-schema
fragment token
得到一个FRAGMEN认证托肯.
USAGE
$ fragment token [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
EXAMPLES
$ fragment token
fragment update
更新FRAGMENT CLI
USAGE
$ fragment update [-y] [--dry-run]
FLAGS
-y, --yes
--dry-run
DESCRIPTION
Update the FRAGMENT CLI
EXAMPLES
$ fragment update
fragment update-ledger-account
更新您小块块块内的编辑器账户 .
USAGE
$ fragment update-ledger-account --update.name <value> [-v] [-p <value> | --ledgerAccount.id <value>] [-l <value>]
[--ledger.id <value>]
FLAGS
-l, --ledger.ik=<value> The Idempotency Key of the Ledger the Ledger Account is in.
-p, --ledgerAccount.path=<value> The unique path of the Ledger Account.
-v, --verbose Enable verbose mode (prints GraphQL commands).
--ledger.id=<value> The Fragment ID of the Ledger the Ledger Account is in.
--ledgerAccount.id=<value> The Fragment ID of the Ledger Account.
--update.name=<value> (required)
DESCRIPTION
Update a Ledger Account within your Fragment Ledger.
This mirrors the updateLedgerAccount mutation in the GraphQL API.
EXAMPLES
$ fragment update-ledger-account
fragment verify-schema
验证一个 schema 文件是否遵循 Flagment JSON schema 格式
USAGE
$ fragment verify-schema [-p <value>] [-v] [-j] [-a <value>]
FLAGS
-a, --against=<value> Path to a previous version of the schema to check backwards compatibility against (e.g. the
output of `fragment get-schema`)
-j, --json Output validation results as JSON for programmatic use
-p, --path=<value> [default: fragment/fragment.json] Path to schema file (e.g. my-schema.jsonc)
-v, --verbose Show detailed validation output
DESCRIPTION
Verify that a schema file follows the Fragment JSON schema format
EXAMPLES
$ fragment verify-schema
$ fragment verify-schema --path ./my-schema.jsonc
$ fragment verify-schema -p fragment/fragment.json --verbose
$ fragment verify-schema --path ./my-schema.jsonc --json
Check that the schema is backwards-compatible with the deployed schema.
$ fragment get-schema --key my-schema --output deployed-schema.jsonc && fragment verify-schema --path \
my-schema.jsonc --against deployed-schema.jsonc
Check that the schema is backwards-compatible with its copy on the main branch.
$ git show origin/main:my-schema.jsonc > base-schema.jsonc && fragment verify-schema --path my-schema.jsonc \
--against base-schema.jsonc
fragment version
打印已安装的 FRAGMENT CLI 版本.
USAGE
$ fragment version
DESCRIPTION
Print the installed FRAGMENT CLI version.
EXAMPLES
$ fragment version
fragment workspace
获取 CLI 认证的工作空间的细节
USAGE
$ fragment workspace [-v]
FLAGS
-v, --verbose Enable verbose mode (prints GraphQL commands).
DESCRIPTION
Get the details of the workspace this CLI is authenticated to
EXAMPLES
$ fragment workspace