lib/os/user-management/add-group.js
function addGroup(group, options) {
  options = _.opts(options, {gid: null});
  if (!runningAsRoot()) return;
  if (!group) throw new Error('You must provide a group');
  if (groupExists(group)) {
    return;
  }

  if (isPlatform('linux')) {
    _addGroupLinux(group, options);
  } else if (isPlatform('osx')) {
    _addGroupOsx(group, options);
  } else if (isPlatform('windows')) {
    throw new Error(`Don't know how to add group ${group} on Windows`);
  } else {
    throw new Error(`Don't know how to add group ${group} in current platform`);
  }
}
function addGroup(group, options) {
  options = _.opts(options, {gid: null});
  if (!runningAsRoot()) return;
  if (!group) throw new Error('You must provide a group');
  if (groupExists(group)) {
    return;
  }

  if (isPlatform('linux')) {
    _addGroupLinux(group, options);
  } else if (isPlatform('osx')) {
    _addGroupOsx(group, options);
  } else if (isPlatform('windows')) {
    throw new Error(`Don't know how to add group ${group} on Windows`);
  } else {
    throw new Error(`Don't know how to add group ${group} in current platform`);
  }
}
function addGroup ( group , options ) { options = _ . opts ( options , { gid : null } ) ; if ( ! runningAsRoot ( ) ) return ; if ( ! group ) throw new Error ( 'You must provide a group' ) ; if ( groupExists ( group ) ) { return ; } if ( isPlatform ( 'linux' ) ) { _addGroupLinux ( group , options ) ; } else if ( isPlatform ( 'osx' ) ) { _addGroupOsx ( group , options ) ; } else if ( isPlatform ( 'windows' ) ) { throw new Error ( ` ${ group } ` ) ; } else { throw new Error ( ` ${ group } ` ) ; } }
Add a group to the system
@function $os~addGroup
@param {string} group - Groupname
@param {Object} [options]
@param {string|number} [options.gid=null] - Group ID
@example
// Creates group 'mysql'
$os.addGroup('mysql');
Add a group to the system