dry-wit 3 is out

I've decided to wrap the current state of dry-wit as a new version. I've finished some initial tests and now I'm confident dry-wit scripts can now run other dry-wit scripts without conflicting each other.

As before, the API documentation is available here.

Release notes

  • Stateful modules:
    • Each module that needs its own variables can now define them using DW.declareGlobalString, DW.declareGlobalInt, DW.declareGlobalArray, DW.declareGlobalMap.
    • They're expected to provide an unique name, to avoid variable name conflicts. Usually, it'll be provided by [module].getModuleName() function.
    • For string or int variables, you can retrieve the variable value by just doing something like:
      [module].getModuleName;
      DW.getGlobalString "${RESULT}" MY_VARIABLE;
    • For array or associative arrays, you can retrieve the variable value similarly:
      [module].getModuleName;
      DW.getGlobalVariableName "${RESULT}" MY_ARRAY;
      local -n myArray=${RESULT};
    • For string or int variables, you can set a new value with:
      [module].getModuleName;
      DW.setGlobalString "${RESULT}" MY_VARIABLE "new-value";
    • For array or associative arrays, you can change its contents with:
      [module].getModuleName;
      DW.getGlobalVariableName "${RESULT}" MY_ARRAY;
      local -n myArray=${RESULT};
      myArray[0]='hello';
      myArray[1]='world';
  • Improved CLI, logging modules.
  • Improved modules, and added new functions:
    • array.dw:
      • getIndexOfItemInArray
    • cli.dw:
      • setScriptCopyright
      • setScriptDescription
      • setScriptLicenseSummary
    • number.dw:
      • lastDigit
    • string.dw:
      • camelCaseToPascalCase
      • camelCaseToSnakeCase
      • snakeCaseToCamelCase
      • snakeCaseToPascalCase
      • uncapitalize
      • capitalize
      • tailText
      • countMatchesOfCharsInString
      • firstCharacter
      • lastCharacter
  • Added 35 new unit tests.

dry-wit 2

dry-wit 2 release notes can be found here.