marmelab / greenframe-cli

Estimate the carbon footprint of a user scenario on a web application
https://greenframe.io
Other
224 stars 10 forks source link

Unable to run example command #83

Closed Djiit closed 1 month ago

Djiit commented 2 months ago

Hey there, I've just installed the tool and ran:

❯ greenframe analyze https://marmelab.com
✔ Check configuration file
⠋ Retrieving Git information
◼ Analysis is in progress locally
✔ Check configuration file
✔ The folder is not a git repository
✔ Analysis is in progress locally
  ✔ Docker version 26.0.1, build d260a54c81
  ✔ Running 1 scenario(s)...

Analysis complete !

Result summary:

❌ main scenario failed
This scenario failed during the execution:
Command failed: /Users/julien.tanay/.local/lib/greenframe/dist/bash/getHostIP.sh
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]
eth0 not found
Usage: ip addr show [ dev STRING ]
       ip addr { add | del } PREFIX dev STRING
printf: usage: printf [-v var] format [arguments]

Use greenframe open command to run your scenario in debug mode.

I'm running an 14.5 Macos (M1 Macbook)

fzaninotto commented 1 month ago

Thanks for the report! Indeed, it seems grep on MacOS doesn't support the -P method.

The culprit: https://github.com/marmelab/greenframe-cli/blob/f199983e9d17741d9031cd0d18ffd4de10b6ff13/src/bash/getHostIP.sh#L8-L10