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

optparse-bash: Init at 2021-06-13 #121937

Merged
merged 1 commit into from Aug 11, 2021

Conversation

ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented May 6, 2021

Motivation for this change

Optparse provides a wrapper of the POSIX getopts as a clean and easy-to-use command-line argument parser.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ShamrockLee ShamrockLee force-pushed the optparse-bash branch 2 times, most recently from dcbd977 to 984b883 Compare May 8, 2021 19:54
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented May 8, 2021

checkPhase is now added.

@ShamrockLee
Copy link
Contributor Author

Dependencies including sed, awk and printf are now added and patched into optparse.bash.

@ShamrockLee ShamrockLee force-pushed the optparse-bash branch 2 times, most recently from 59854f3 to 866b3f1 Compare May 9, 2021 01:41
@ShamrockLee ShamrockLee force-pushed the optparse-bash branch 2 times, most recently from a605d96 to b1520cb Compare May 29, 2021 22:48
pkgs/development/libraries/optparse-bash/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/optparse-bash/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/optparse-bash/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/optparse-bash/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/optparse-bash/default.nix Outdated Show resolved Hide resolved
@ShamrockLee ShamrockLee changed the title optparse-bash: Init at unstable-20170611 optparse-bash: Init at 2017-06-11 May 30, 2021
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv optparse.bash $out/bin/
Copy link
Contributor

Choose a reason for hiding this comment

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

./results/optparse-bash/bin/optparse.bash
bash: ./results/optparse-bash/bin/optparse.bash: Permission denied

You can use 'install' command to set permission.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@superherointj

optparse.bash is meant to be sourced (as a "header file" of BASH functions) instead of being executed.

I put it inside $out/bin so that users can source it like

source optparse.bash

instead of

source /nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-optparse-bash-0000-00-00/libexec/optparse.bash

Is there a cleaner approach of doing so?

Copy link
Member

Choose a reason for hiding this comment

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

If you use it in a nix package then you can substitute the store path with ${optparse}/libexec/optparse.bash.

@ShamrockLee ShamrockLee changed the title optparse-bash: Init at 2017-06-11 optparse-bash: Init at 2021-06-13 Jul 16, 2021
@SuperSandro2000 SuperSandro2000 merged commit 6d96191 into NixOS:master Aug 11, 2021
@ShamrockLee ShamrockLee deleted the optparse-bash branch January 10, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants