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

Add support for array of inputs #9

Merged
merged 7 commits into from
May 5, 2020
Merged

Add support for array of inputs #9

merged 7 commits into from
May 5, 2020

Conversation

jgradim
Copy link
Contributor

@jgradim jgradim commented Nov 27, 2019

Fixes #2

file-icon Swift executable

  • first and third CLI arguments are treated as comma-separated arrays
  • if multiple apps are passed as the first CLI argument and the output is written to STDOUT, files are separated by <EOF>

file-icon NodeJS library

  • Convert all single value inputs into arrays and treat all file arguments as an array
  • fileIcon.buffer returns a Promise<Buffer> if file is a single value, but will return a <Promise<Array<Buffer>> if file is an array
  • Add stricter argument validation with tests
  • Add tests for all possible use cases and value types with new API
  • Update ava package to 2.4.0

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

### file-icon Swift executable

- first and third CLI arguments are treated as comma-separated arrays
- if multiple apps are passed as the first CLI argument and the output is written to STDOUT, files are separated by `<EOF>`

### file-icon NodeJS library

- Convert all single value inputs into arrays and treat all `file` arguments as an array
- fileIcon.buffer returns a `Promise<Buffer>` if `file` is a single value, but will return a `<Promise<Array<Buffer>>` if `file` is an array
- Add stricter argument validation with tests
- Add tests for all possible use cases and value types with new API
- Update ava package to 2.4.0
Copy link

@satazor satazor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, the PR looks good!

Just one minor thing.

readme.md Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title Feature: Add support for array of inputs Add support for array of inputs Nov 29, 2019
readme.md Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
test.js Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@jgradim
Copy link
Contributor Author

jgradim commented Dec 2, 2019

@sindresorhus Thanks for the thorough review! I've been pretty busy these last few days, will try to address / reply to all comments between tomorrow and wednesday.

- Change all instances of id to ID, pid to PID in test names
- Test buffer array lengths
- Remove anonymous function usage in `t.throwsAsync` and `t.notThrowsAsync`
- Send a single JSON string as CLI argument
- Remove PID detection from JS, check in Swift instead (simplify CLI input)
@jgradim
Copy link
Contributor Author

jgradim commented Dec 9, 2019

@sindresorhus Updated with requested changes

Sources/file-icon/main.swift Outdated Show resolved Hide resolved
Sources/file-icon/main.swift Outdated Show resolved Hide resolved
Sources/file-icon/main.swift Outdated Show resolved Hide resolved
Sources/file-icon/main.swift Outdated Show resolved Hide resolved
Sources/file-icon/main.swift Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
- Don't force unwrap, use `if let` instead
- Rename input.application to input.appOrPID
- Don't use one character variable names
- Change `Array<string>` to `string[]` in readme.md
@jgradim
Copy link
Contributor Author

jgradim commented Jan 16, 2020

@sindresorhus updated!

@sindresorhus
Copy link
Owner

@jgradim
Copy link
Contributor Author

jgradim commented Mar 2, 2020

@sindresorhus Missed that comment. Unfortunately I've been pretty busy and had no real time to dedicate to this issue. I will take a better look, and am planning to pick this up again this weekend. Thank you and sorry for the delay!

- Use multiple concurrent calls to Swift binary in `buffer` mode
- Add pMap as a dependency
@sindresorhus
Copy link
Owner

Is this ready?

@jgradim
Copy link
Contributor Author

jgradim commented May 4, 2020

If it's ok with you, I would consider this ready, yes :)

@sindresorhus sindresorhus merged commit a4f1bde into sindresorhus:master May 5, 2020
@sindresorhus
Copy link
Owner

Looks great! Thanks for persevering through this. It ended up really well.

@jgradim
Copy link
Contributor Author

jgradim commented May 5, 2020

Awesome, glad I could help! 😄

@jgradim jgradim deleted the feature/array-inputs branch May 5, 2020 17:47
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.

Add support for array of inputs
4 participants