Skip to content

Skip prompting for platform and appType when only one option available#325

Merged
wmathurin merged 1 commit into
forcedotcom:devfrom
wmathurin:skip-apptype-prompt-when-only-one-option
Apr 10, 2026
Merged

Skip prompting for platform and appType when only one option available#325
wmathurin merged 1 commit into
forcedotcom:devfrom
wmathurin:skip-apptype-prompt-when-only-one-option

Conversation

@wmathurin
Copy link
Copy Markdown
Contributor

@wmathurin wmathurin commented Apr 10, 2026

Summary

  • Skip platform prompt when CLI has only one platform (e.g., forceios has only 'ios')
  • Skip appType prompt when CLI has only one appType
  • Hide appType description/longDescription when only one option available
  • Standardize all promptIf functions to use consistent curried pattern

Changes

configHelper.js

  • No changes to applyCli() function - it now handles all promptIf functions consistently
  • promptIf is applied via applyCli() like all other function-valued arguments

constants.js

  • Added promptIf: cli => otherArgs => cli.platforms.length > 1 to platform argument
  • Added promptIf: cli => otherArgs => cli.appTypes.length > 1 to appType argument
  • Modified description and longDescription for appType to return empty string when only one option
  • Updated all existing promptIf functions to use consistent curried pattern cli => otherArgs => ...
    • templateRepoUri, templateSource, template, startPage now all follow the same pattern
    • This ensures consistency even though some don't use the cli parameter

Behavior

Before: Always prompted for platform/appType even with single option
After: Automatically uses the single option without prompting

Examples

# forceios (only has 'ios' platform)
forceios create --appname=Test --packagename=com.test --organization=Test
# Previously: Prompted "Enter target platform: (ios):"
# Now: Skips platform prompt entirely

# If removing native templates leaves only native_swift
forceios create ...
# Will skip appType prompt automatically

Testing

  • Verified platform prompt skipped for forceios (single platform)
  • Verified appType prompt still appears for forceios (has native, native_swift)
  • Help text shows empty description when only one appType available
  • All iOS native templates generate and build successfully via test_force.js

Related

Supports the template removal workflow - when removing templates leaves a CLI with only one appType, prompting is automatically skipped with no additional code changes needed.

@wmathurin wmathurin force-pushed the skip-apptype-prompt-when-only-one-option branch 2 times, most recently from a74e3a2 to d5f719e Compare April 10, 2026 01:03
When a CLI tool has only one platform (e.g., forceios has only 'ios') or only
one appType, skip the interactive prompt and automatically use that single option.

This improves the user experience by reducing unnecessary prompts, and also
future-proofs the CLI tools - if templates are removed such that a CLI ends up
with only one appType option, the prompting will automatically be skipped without
requiring any code changes.

Changes:
- Modified configHelper.js to apply cli context to promptIf via applyCli()
- Added promptIf functions to platform and appType arguments in constants.js
  that check if there's more than one option before prompting
@wmathurin wmathurin force-pushed the skip-apptype-prompt-when-only-one-option branch from d5f719e to 377c554 Compare April 10, 2026 01:19
wmathurin added a commit to wmathurin/SalesforceMobileSDK-Package that referenced this pull request Apr 10, 2026
Updated after removing iOSNativeTemplate and AndroidNativeTemplate from
Templates repository. The native appType has been completely eliminated,
with native_swift and native_kotlin remaining as the modern alternatives.

Changes:
- setup_test_branches.js: Removed native templates from templatesPackageJsons array
- constants.js: Removed 'native' from forceios and forcedroid appTypes and appTypesToPath
- test_force.js: Removed 'native' from APP_TYPE enum
- Regenerated OCLIF commands for SFDX plugin
- Updated SFDX README (with expected errors for uninstalled plugin)
- Updated CLAUDE.md documentation example to reflect new structure

With only one appType remaining for forceios and forcedroid, the appType
prompt will be automatically skipped (via PR forcedotcom#325 changes).
@wmathurin wmathurin merged commit dd6ede4 into forcedotcom:dev Apr 10, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants