Finch CLI

Finch 提供了一个命令行界面(CLI)用于管理和与您的 Finch 应用程序交互。CLI 提供了一系列命令来简化常见任务,使开发、测试和部署应用程序变得更容易。

除了 Finch 提供的命令之外,您还可以使用任何其他 Dart CLI 命令。例如,您可以使用 dart pub get 命令来获取项目的依赖项。使用 Finch CLI 是可选的,您也可以直接使用 Dart CLI。

安装 Finch CLI

dart pub global activate finch

运行 Finch CLI

要查看可用命令列表,请运行以下命令:

finch -h
✔ templates
        Show the list of available templates
✔ create
        Make new project
        -p, --path       Path of the project
        -n, --name       Name of project
        -d, --docker     Use docker
        -t, --template   Project template [simple, example,...]
✔ get
        Get packages of project, (dart pub get)
✔ runner
        Build runner of project, (dart pub run build_runner build)
✔ run
        Run project, (dart run)
        -p, --path       Path of app file
        -a, --args       Arguments for app file
✔ serve
        Serve project with file watcher
        -p, --path       Path of app file
        -a, --args       Arguments for app file
✔ build
        Build Project (dart compile exe)
        -c, --cli        Build for cli
        -a, --appPath    Path of app file
        -l, --langPath   Languages path
        -p, --publicPath Public path
        -w, --widgetPath Widgets path
        -e, --envPath    Envitoment file (.env) path
        -o, --output     Output path
        -t, --type       Type of build (zip, exe)
✔ migrate
        Migrate project to new version of Finch
        -c, --create     Create new project and move files
        -n, --name       Name of migration file (only for create option)
        -s, --sqlite     Migrate SQLite files
✔ test
        Unit test of project, (dart test)
        -r, --reporter   Set how to print test results

        -h, --help       Show the help
        -v, --version    Finch Version
        -u, --update     Update Finch