Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass list of devices as arguments to the lane #41

Closed
ngouass opened this issue Jul 15, 2018 · 5 comments
Closed

How to pass list of devices as arguments to the lane #41

ngouass opened this issue Jul 15, 2018 · 5 comments

Comments

@ngouass
Copy link

ngouass commented Jul 15, 2018

Hi, I don't know ruby language and I'm trying to find a way to pass list of devices as arguments since values are not string.

current state

lane :test1 do
  appicon(
      appicon_image_file: 'spec/fixtures/Themoji.png',
      appicon_devices: [:ipad, :iphone, :ios_marketing])
end

expecting state

lane :test1 do |options|
  appicon(
      appicon_image_file: 'spec/fixtures/Themoji.png',
      appicon_devices: options[:devices]
  )
end

command:

bundle exec fastlane test1 devices:"[:iphone, :ipad, :ios_marketing]"

Thanks.

@KrauseFx
Copy link
Member

It's not possible to pass an array via the command line for now, sorry. You'll have to define it in your Fastfile for now, you could manually build something to parse the CLI options differently though, however it's out of the scope for this project.

Assuming you have 2-3 configurations, it's probably easiest to just have multiple lanes each with a different list.

@ngouass
Copy link
Author

ngouass commented Jul 17, 2018

@KrauseFx thanks for this answer! it actually looks clean to separate them.

@ngouass ngouass closed this as completed Jul 17, 2018
@lukasondrak96
Copy link

@KrauseFx Is this still true? You cannot pass an array via command line? Thanks

@madarasz
Copy link

@lukasondrak96
https://docs.fastlane.tools/actions/prompt/

Arrays can be passed as a comma delimited string (e.g. param:"1,2,3").

@francardoso93
Copy link

francardoso93 commented Jul 19, 2023

That's how I've managed to do this:

lane :github_commit_and_pull_request do|options
       schemes_list = JSON.parse(options[:schemes_list])
       schemes_list.each do |scheme|
           ....
       end    
...
end

Call this lane with parameter value with a JSON array as the string value:
bundle exec fastlane github_commit_and_pull_request schemes_list:'["test","test"]'

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

No branches or pull requests

5 participants