platform-info icon indicating copy to clipboard operation
platform-info copied to clipboard

Add processor() method to UNameAPI trait

Open naoNao89 opened this issue 3 months ago • 6 comments

Adds processor() method that maps machine architecture strings to processor types, matching GNU coreutils behavior.

Fixes uutils/coreutils#8659

Example

let info = PlatformInfo::new()?;
let processor = info.processor(); // "arm" on macOS arm64, "aarch64" on Linux ARM64

This enables uutils/coreutils PR #8842 to migrate from local mapping to platform-info abstraction.

naoNao89 avatar Oct 08 '25 15:10 naoNao89

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.75%. Comparing base (dddde16) to head (f0bb916).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   93.32%   93.75%   +0.42%     
==========================================
  Files           4        5       +1     
  Lines         734      784      +50     
==========================================
+ Hits          685      735      +50     
  Misses         49       49              
Flag Coverage Δ
macos_latest 99.35% <100.00%> (+0.19%) :arrow_up:
ubuntu_latest 99.37% <100.00%> (+0.18%) :arrow_up:
windows_latest 92.99% <100.00%> (+0.40%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Oct 08 '25 15:10 codecov[bot]

please also update: https://github.com/uutils/platform-info/blob/main/README.md

sylvestre avatar Oct 08 '25 18:10 sylvestre

@sylvestre Updated! README now includes processor() in the example code and output.

naoNao89 avatar Oct 09 '25 02:10 naoNao89

give what Colin wrote in https://github.com/uutils/coreutils/pull/8842 not sure we should do it, sorry

sylvestre avatar Oct 19 '25 19:10 sylvestre

Why not? If you want distros to start using it, you need to make it compatible. uutils has its own extensions too, and implements many other GNU extensions.

RGBCube avatar Oct 20 '25 09:10 RGBCube

see: https://github.com/uutils/coreutils/pull/8842#issuecomment-3384684221 (Note that Collin is GNU coreutils upstream)

Anyway, we can still merge this feature in this crate and not use it in the coreutils

sylvestre avatar Oct 20 '25 11:10 sylvestre