Rename CLI Tool v3

GitHub issues GitHub pull requests GitHub contributors GitHub

Warning

  • This package may not be compatible with a flavor setup.
  • The API has undergone significant changes; many elements have been deprecated. Please refer to the usage section for the updated functionalities.

About

The Rename CLI Tool is a utility designed to modify your Flutter project's AppName and BundleId across various platforms. The supported platforms include:

  • IOS
  • Android
  • MacOS
  • Linux
  • Web (only app name related functionality)
  • Windows

Installation

To install the Rename CLI Tool, execute the following command:

flutter pub global activate rename

Running a Script

You can run a script directly using rename from the activated package through the command line. If facing any issues, alternate commands are dart pub global run rename or flutter pub global run rename. For path variable issues, refer to ensuring your path variables are set up correctly.

Usage

Please ensure you are in the Flutter project root directory before executing any commands. The tool supports various commands for retrieving and setting the AppName and BundleId:

Help

Display general help or command-specific help using:

rename help
A CLI tool that helps for renaming in Flutter projects.

Usage: rename <command> [arguments]

Global options:
-h, --help       Print this usage information.
-v, --version    

Available commands:
  getAppName    Get app names for the targeted platforms
  getBundleId   Get bundleId identifiers for the targeted platforms
  setAppName    Set app name for the targeted platforms
  setBundleId   Set bundleId identifier for the targeted platforms

Run "rename help <command>" for more information about a command.

or for a specific command:

rename help <commandName>
Example output for 'rename help setAppName':
Set app name for the targeted platforms

Usage: rename setAppName [arguments]
-h, --help                 Print this usage information.
-t, --targets              Set which platforms to target.
                           [ios (default), android (default), macos, linux, web, windows]
-v, --value (mandatory)    Set value of the given command

Run "rename help" to see global options.

Get AppName

To retrieve the current AppName for a specific platform:

rename getAppName --targets ios
This will output the current AppName for the iOS platform.

or for multiple targets:

rename getAppName --targets ios,android,macos,windows,linux

Set AppName

To set the AppName for specific platforms:

rename setAppName --targets ios,android --value "YourAppName"
This will set the AppName for the iOS and Android platforms to "YourAppName".

Get/Set BundleId

Similarly, use getBundleId and setBundleId to retrieve or set the BundleId for the specified platforms.

rename getBundleId --targets android
This will output the current BundleId for the Android platform.
rename setBundleId --targets android --value "com.example.bundleId"
This will set the BundleId for the Android platform to "com.example.bundleId".

Parameters

Commands

  • setAppName: Change the App Name for the given --targets. The --value option is required.
  • setBundleId: Change the bundle identifiers for the given --targets. The --value option is required.
  • getAppName: Display the app names for the given --targets.
  • getBundleId: Display the bundle identifiers for the given --targets.

Options

  • -t, --targets: Specify the target platforms. Options include android, ios, web, windows, macos, linux. This parameter is mandatory for all commands.
  • -v, --value: Set the value for the specified command. Mandatory for setAppName and setBundleId.
  • -h, --help: Display available instructions for the related command.

Upcoming Features

License

This project is licensed under the MIT License. Refer to the LICENSE file for details.

Contributing

Contributions are welcome! Please refer to our contributing guidelines to get started.

Changelog

For all notable changes to this project, refer to the CHANGELOG.

Support

For any issues or suggestions, please open an issue. Your feedback is highly appreciated.

Author

This project is created and maintained by Onat Çipli.

Troubleshooting

Command Not Working on Windows

If you encounter issues running the rename command directly in Windows, especially from a non-administrator terminal, you might need to use an alternative command format. This issue can arise due to permission restrictions or path variable misconfigurations.

Try executing the command using one of the following formats:

  • Using Flutter:
    flutter pub run rename <command> [arguments]
    
  • Using Dart:
    dart run rename <command> [arguments]
    

These alternative commands explicitly invoke the rename tool through the Dart or Flutter toolchain, which can bypass some of the path or permission issues encountered in certain Windows configurations.

Libraries

platform_file_editors/abs_platform_file_editor
File: abs_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file defines the abstract class for PlatformFileEditors and its methods.
platform_file_editors/android_platform_file_editor
File: android_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file defines the AndroidPlatformFileEditor class which is responsible for editing Android platform files.
custom_exceptions
File: custom_exceptions.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file defines custom exceptions for the rename project.
enums
platform_file_editors/ios_platform_file_editor
File: ios_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file is responsible for editing iOS platform files.
platform_file_editors/linux_platform_file_editor
File: linux_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file is responsible for editing Linux platform files.
platform_file_editors/macos_platform_file_editor
File: macos_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file is responsible for editing macOS platform files.
rename
File: rename.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file contains the Rename class which is responsible for renaming platform files.
commands/rename_command_runner
File: rename_command_runner.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file defines RenameCommandRunner for the rename project and its commands, options etc.
platform_file_editors/web_platform_file_editor
File: web_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file is responsible for editing Web platform files.
platform_file_editors/windows_platform_file_editor
File: windows_platform_file_editor.dart Project: rename Author: Onat Cipli Created Date: 24.09.2023 Description: This file is responsible for editing Windows platform files.