diff --git a/.eslintrc b/.eslintrc index 7b84619..ad65bbb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,5 +2,10 @@ "extends": [ "oclif", "oclif-typescript" - ] + ], + "rules": { + "no-prototype-builtins": 0, + "camelcase": 0, + "unicorn/filename-case": 0 + } } diff --git a/.gitignore b/.gitignore index 12865b1..c9fca12 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ node_modules oclif.manifest.json .idea flagsmith.json +FlagsmithTypes.ts +tsconfig.tsbuildinfo diff --git a/1 - Adding a remote config.mov b/1 - Adding a remote config.mov new file mode 100644 index 0000000..9823bcf Binary files /dev/null and b/1 - Adding a remote config.mov differ diff --git a/2 - Creating a new flag.mov b/2 - Creating a new flag.mov new file mode 100644 index 0000000..891c93a Binary files /dev/null and b/2 - Creating a new flag.mov differ diff --git a/3 - Dry run removing flag.mov b/3 - Dry run removing flag.mov new file mode 100644 index 0000000..7ed1fa7 Binary files /dev/null and b/3 - Dry run removing flag.mov differ diff --git a/README.md b/README.md index aecd205..fb412a3 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ $ npm install -g flagsmith-cli $ flagsmith COMMAND running command... $ flagsmith (--version) -flagsmith-cli/0.1.2 darwin-arm64 node-v18.13.0 +flagsmith-cli/0.3.0 darwin-arm64 node-v18.20.4 $ flagsmith --help [COMMAND] USAGE $ flagsmith COMMAND @@ -62,38 +62,70 @@ USAGE # Commands +* [`flagsmith generate-types PROJECT`](#flagsmith-generate-types-project) * [`flagsmith get [ENVIRONMENT]`](#flagsmith-get-environment) * [`flagsmith help [COMMANDS]`](#flagsmith-help-commands) +## `flagsmith generate-types PROJECT` + +Fetch Flagsmith feature flags as JSON. By default pipes to stdout, allowing use with other tools; or write to a file with -o. + +``` +USAGE + $ flagsmith generate-types PROJECT [-a ] [-o ] [-e ] [-p] + +ARGUMENTS + PROJECT Flagsmith project ID + +FLAGS + -a, --api= [default: https://api.flagsmith.com] The API endpoint (if self-hosted) + -e, --exclude= Comma-separated list of feature names to exclude + -o, --output= Write the fetched JSON to a file instead of stdout + -p, --parseObjects (experimental) Include full object values when fetching features + +DESCRIPTION + Fetch Flagsmith feature flags as JSON. By default pipes to stdout, allowing use with other tools; or write to a file + with -o. + +EXAMPLES + export FLAGSMITH_API_KEY=YOUR_KEY flagsmith generate-types PROJECT_ID | npx quicktype \ + --src-lang json \ + --lang typescript \ + --just-types \ + --explicit-unions \ + --acronym-style camel \ + --top-level FlagsmithTypes \ + -o FlagsmithTypes.ts + + export FLAGSMITH_API_KEY=YOUR_KEY flagsmith generate-types PROJECT_ID -o features.json +``` + +_See code: [src/commands/generate-types/index.ts](https://github.com/Flagsmith/flagsmith-cli/blob/v0.3.0/src/commands/generate-types/index.ts)_ + ## `flagsmith get [ENVIRONMENT]` Retrieve flagsmith features from the Flagsmith API and output them to a file. ``` USAGE - $ flagsmith get [ENVIRONMENT] [-o ] [-a ] [-t - -i ] [-p] [-e flags|environment] + $ flagsmith get [ENVIRONMENT] [-o ] [-a ] [-t =... -i ] + [-p] [-e flags|environment] ARGUMENTS - ENVIRONMENT The flagsmith environment key to use, defaults to the environment - variable FLAGSMITH_ENVIRONMENT + ENVIRONMENT The flagsmith environment key to use, defaults to the environment variable FLAGSMITH_ENVIRONMENT FLAGS - -a, --api= [default: https://edge.api.flagsmith.com/api/v1/] The - API URL to fetch the feature flags from - -e, --entity=