configure 529 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # set configurations that will be "sticky" on this system,
  3. # surviving npm self-updates.
  4. CONFIGS=()
  5. i=0
  6. # get the location of this file.
  7. unset CDPATH
  8. CONFFILE=$(cd $(dirname "$0"); pwd -P)/npmrc
  9. while [ $# -gt 0 ]; do
  10. conf="$1"
  11. case $conf in
  12. --help)
  13. echo "./configure --param=value ..."
  14. exit 0
  15. ;;
  16. --*)
  17. CONFIGS[$i]="${conf:2}"
  18. ;;
  19. *)
  20. CONFIGS[$i]="$conf"
  21. ;;
  22. esac
  23. let i++
  24. shift
  25. done
  26. for c in "${CONFIGS[@]}"; do
  27. echo "$c" >> "$CONFFILE"
  28. done