How to use the command "pio platform" (with examples)
The “pio platform” command is used to manage PlatformIO development platforms. It allows you to list installed platforms, search for existing platforms, show details about a platform, install and update platforms, and uninstall a specific platform. Additionally, it provides the capability to list all supported frameworks.
Use case 1: List all installed development platforms
Code:
pio platform list
Motivation: This use case is useful when you want to get a list of all the development platforms that are currently installed in your PlatformIO environment.
Explanation: The “pio platform list” command lists all the installed development platforms. It does not require any arguments.
Example OUTPUT:
The following development platforms are installed:
- platform 1
- platform 2
- platform 3
Use case 2: Search for existing development platforms
Code:
pio platform search platform
Motivation: This use case is helpful when you need to find a specific development platform among the available ones.
Explanation: The “pio platform search platform” command allows you to search for all the development platforms containing the word “platform” in their name. Replace “platform” with your desired search keyword.
Example OUTPUT:
The following development platforms contain the keyword "platform":
- platform1
- platform2
- platform3
Use case 3: Show details about a development platform
Code:
pio platform show platform
Motivation: This use case is valuable when you want to obtain detailed information about a specific development platform, such as its supported frameworks, versions, or other relevant details.
Explanation: The “pio platform show platform” command displays detailed information about the specified development platform. Replace “platform” with the name of the desired platform.
Example OUTPUT:
Details of the "platform" development platform:
- Frameworks: framework1, framework2, framework3
- Versions: 1.0.0, 2.0.0
- Description: This development platform provides support for XYZ.
Use case 4: Install a development platform
Code:
pio platform install platform
Motivation: This use case is useful when you want to install a new development platform to expand your PlatformIO toolkit and support development for a different range of target boards or frameworks.
Explanation: The “pio platform install platform” command installs the specified development platform. Replace “platform” with the name of the platform you want to install.
Example OUTPUT:
The "platform" development platform has been successfully installed.
Use case 5: Update installed development platforms
Code:
pio platform update
Motivation: This use case is valuable when you want to update all the installed development platforms to ensure you have the latest versions and bug fixes.
Explanation: The “pio platform update” command updates all the installed development platforms to the latest available versions.
Example OUTPUT:
All installed development platforms have been successfully updated.
Use case 6: Uninstall a development platform
Code:
pio platform uninstall platform
Motivation: This use case is helpful when you want to remove a development platform that is no longer needed to declutter your PlatformIO environment.
Explanation: The “pio platform uninstall platform” command uninstalls the specified development platform. Replace “platform” with the name of the platform you want to uninstall.
Example OUTPUT:
The "platform" development platform has been successfully uninstalled.
Use case 7: List all supported frameworks
Code:
pio platform frameworks
Motivation: This use case is useful when you want to get a list of all the supported frameworks by the installed development platforms, allowing you to choose the appropriate framework for your project.
Explanation: The “pio platform frameworks” command lists all the supported frameworks by the installed development platforms. It does not require any arguments.
Example OUTPUT:
The following frameworks are supported by the installed development platforms:
- framework1
- framework2
- framework3
Conclusion:
The “pio platform” command is a powerful tool to manage PlatformIO development platforms. It provides a wide range of functionalities such as listing, searching, installing, updating, and uninstalling development platforms, as well as listing supported frameworks. Understanding and utilizing these use cases will help you effectively manage your development platforms and frameworks in the PlatformIO ecosystem.