Skip to Content
CLI Usage

Sicilian CLI Usage

@ilokesto/sicilian provides a CLI (Command Line Interface) tool to enhance developer productivity and reduce repetitive coding. With this CLI, you can easily generate and add code snippets to your project.

help Command

The help command displays information about the usage of the Sicilian CLI and available flags and options.

Usage

sicilian -help

Alternatively, the help message is also displayed when you run the sicilian command without any arguments.

sicilian

generate Command

The generate command creates new code snippets and adds them to the specified file.

Usage

sicilian -g <file_path> [options]
  • <file_path>: Specifies the path to the file where the snippet will be generated. If the file does not exist, it will be created. If it already exists, the snippet will be appended to the end of the file. Parent directories will be created automatically if needed.

Options

  • -o, --object: Generates an object-style snippet. If this option is not used, a destructured assignment-style snippet is generated by default.

Examples

1. Basic Snippet Generation (Destructured Assignment)

Use the following command to generate a destructured assignment-style snippet in src/components/MyForm.tsx:

sicilian -g src/components/MyForm.tsx

Running this command will add code similar to the following to src/components/MyForm.tsx:

import { useForm } from '@ilokesto/sicilian'; const { register, handleSubmit, getErrors } = useForm({ initValue: {}, validator: {}, });

2. Object Snippet Generation

Use the following command to generate an object-style snippet in src/utils/formHooks.ts:

sicilian -g src/utils/formHooks.ts -o

Running this command will add code similar to the following to src/utils/formHooks.ts:

import { useForm } from '@ilokesto/sicilian'; const form = useForm({ initValue: {}, validator: {}, });

Use the CLI to quickly and efficiently write sicilian form-related code.

Last updated on