Constructs a string to represent the usage for a particular task.

@param task - type of action
@return string that holds the usage for param:task
501904
public String getTaskUsage(ExeAction task) {
        StringBuilder taskUsage = new StringBuilder(NL);

        // print a empty line
        taskUsage.append(getHelpPart("global.usage"));
        taskUsage.append(NL);
        taskUsage.append('\t');
        taskUsage.append(COMMAND);
        taskUsage.append(' ');
        taskUsage.append(task);
        taskUsage.append(" [");
        taskUsage.append(getHelpPart("global.options.lower"));
        taskUsage.append("]");

        List<String> options = task.getCommandOptions();
        for (String option : options) {
            if (option.charAt(0) != '-') {
                taskUsage.append(' ');
                taskUsage.append(option);
            }
        }

        taskUsage.append(NL);
        taskUsage.append(NL);
        taskUsage.append(getHelpPart("global.description"));
        taskUsage.append(NL);
        taskUsage.append(getDescription(task));
        taskUsage.append(NL);
        if (options.size() > 0) {
            taskUsage.append(NL);
            taskUsage.append(getHelpPart("global.options"));

            for (String option : task.getCommandOptions()) {
                taskUsage.append(NL);
                String optionKey;
                try {
                    optionKey = getHelpPart(task + ".option-key." + option);
                } catch (MissingResourceException e) {
                    // This happens because we don't have a message for the key for the
                    // license arguments but these are not translated and don't need any
                    // arguments after them so can just use the option
                    optionKey = "    " + option;
                }
                taskUsage.append(optionKey);
                taskUsage.append(NL);
                taskUsage.append(getHelpPart(task + ".option-desc." + option));
                taskUsage.append(NL);
            }
        }
        taskUsage.append(NL);
        return taskUsage.toString();
    }
369235
public String toShortString()
    {
        StringBuilder sb = new StringBuilder();
        taskToString(sb);
        if (m_msg != null) {
            sb.append("\n");
            m_msg.toShortString(sb);
        }
        return sb.toString();
    }
28048
public static InputStream wrap(InputStream is, String task) {
        ProgressBarBuilder pbb = new ProgressBarBuilder().setTaskName(task).setInitialMax(Util.getInputStreamSize(is));
        return wrap(is, pbb);
    }
763011
private static String getActionString(int action) {

        switch (action) {

            case Constraint.RESTRICT :
                return Tokens.T_RESTRICT;

            case Constraint.CASCADE :
                return Tokens.T_CASCADE;

            case Constraint.SET_DEFAULT :
                return Tokens.T_SET + ' ' + Tokens.T_DEFAULT;

            case Constraint.SET_NULL :
                return Tokens.T_SET + ' ' + Tokens.T_NULL;

            default :
                return Tokens.T_NO + ' ' + Tokens.T_ACTION;
        }
    }
418064
public void register(Task task) {
        Optional.ofNullable(task)
                .filter(t -> t.getTask() != null)
                .filter(t -> StringUtils.hasText(t.getName()))
                .ifPresent(t -> checkTaskMap.put(t.getName(), t));
    }
114127
def serialized_task(self, task: Task) -> Tuple[str, str]:
        
        return f"{task.hash}.json", task.json
592346
public String toArgument(Task task)
	{
		task.log(String.format("Repository Class \"%s\"", className), Project.MSG_VERBOSE);

		StringBuilder argumentBuilder = new StringBuilder(className);

		for (TextData argument : arguments)
		{
			task.log(String.format("\tArgument \"%s\"", argument), Project.MSG_VERBOSE);

			argumentBuilder.append(";").append(escapeSemiColon(argument.getText()));
		}

		return argumentBuilder.toString();
	}
1512
public int appendTask(long sourceHSId, TransactionInfoBaseMessage task) throws IOException {
        Preconditions.checkState(compiledSize == 0, "buffer is already compiled");

        final int msgSerializedSize = task.getSerializedSize();
        ensureCapacity(taskHeaderSize() + msgSerializedSize);

        ByteBuffer bb = m_container.b();
        bb.putInt(msgSerializedSize);
        bb.putLong(sourceHSId);

        int limit = bb.limit();
        bb.limit(bb.position() + msgSerializedSize);
        task.flattenToBuffer(bb.slice());
        bb.limit(limit);
        bb.position(bb.position() + msgSerializedSize);

        // Don't allow any further expansion to the underlying buffer
        if (bb.position() + taskHeaderSize() > DEFAULT_BUFFER_SIZE) {
            compile();
            return 0;
        } else {
            return DEFAULT_BUFFER_SIZE - (bb.position() + taskHeaderSize());
        }
    }
968281
def _task_to_text(self, task):
        

        started = self._format_date(task.get('started_at', None))
        completed = self._format_date(task.get('completed_at', None))

        success = task.get('success', None)
        success_lu = {None: 'Not executed', True: 'Success',
                      False: 'Failed'}

        run_log = task.get('run_log', {})
        return '\n'.join(['Task: %s' % task.get('name', None),
                          'Command: %s' % task.get('command', None),
                          'Result: %s' % success_lu[success],
                          'Started at: %s' % started,
                          'Completed at: %s' % completed,
                          'Return Code: %s' % run_log.get('return_code', None),
                          'Stdout: %s' % run_log.get('stdout', None),
                          'Stderr: %s' % run_log.get('stderr', None)])
1028220
function(name, description, action) {
      if (!action) {
        [action, description] = [description, action];
      }
      return tasks[name] = {name, description, action};
    }
1050725
public static String stream2taskName(String old) {
        String[] parts = old.split(DELIM);
        if (parts.length >= 7) {
            parts[0] = MetaType.TASK.getV() + parts[0].charAt(1);
            parts[parts.length - 3] = EMPTY;

            String metricName = getMergeMetricName(parts[parts.length - 1]);
            parts[parts.length - 1] = metricName;
        }
        return concat(parts);
    }
303024
private Integer getOutlineLevel(Task task)
   {
      String value = task.getWBS();
      Integer result = Integer.valueOf(1);
      if (value != null && value.length() > 0)
      {
         String[] path = WBS_SPLIT_REGEX.split(value);
         result = Integer.valueOf(path.length);
      }
      return result;
   }
1081255
def create_task_info(task):
    """"""
    task_info = None
    if task.get('info'):
        task_info = task['info']
    else:
        task_info = task
    return task_info
283141
private String getTaskField(int key)
   {
      String result = null;

      if ((key > 0) && (key < m_taskNames.length))
      {
         result = m_taskNames[key];
      }

      return (result);
   }
1362369
public static String getDays(RecurringTask task)
   {
      StringBuilder sb = new StringBuilder();
      for (Day day : Day.values())
      {
         sb.append(task.getWeeklyDay(day) ? "1" : "0");
      }
      return sb.toString();
   }
596336
private String getTaskIdFromCurrentUsagePath(String path) {
    return path.substring(path.indexOf(TASK_PATH) + TASK_PATH.length() + 1, path.lastIndexOf("/"));
  }
1160099
def to_task(task):
        
        from sevenbridges.models.task import Task
        if not task:
            raise SbgError('Task is required!')
        elif isinstance(task, Task):
            return task.id
        elif isinstance(task, six.string_types):
            return task
        else:
            raise SbgError('Invalid task parameter!')