cmedit – edit the paths in a csmes file

cmedit is a tool to modify the paths of the files in a .csmes file.

Syntax

cmedit [<options>] <infile> [-o <outfile>]

Options

  • <infile>: The .csmes file to be edited. Unless the option -o is set, the changes in the path names are written to this file too. (Required parameter)
  • -o <outfile> | --output=<outfile>: The .csmes output file. If this parameter is set, the original <infile> is unchanged and the edited version of <infile> is written to <outfile>.
  • <options>: Any of:
    • -c <depth> | --cut=<depth>: Remove a common initial segment of all paths in <infile>.

      <depth> is a non-negative integer and describes the number of path components that should be removed. A path component is every sequence of characters that lies between slashes or backslashes. The drive letter (plus colon) at the beginning of a Windows path name is also counted as a path component. Therefore, the command --cut=1 will transform the path /home/someone/main.cpp into /someone/main.cpp, and C:\mydir\main.cpp into \mydir\main.cpp.

      If <depth> is too large, cmedit exits with an error and does nothing. This occurs either if there is a path with less than <depth> components or if there are two paths that differ in the first <depth> components. Therefore, if <infile> contains the two paths /home/someone/myproject/main.cpp and /home/someone/library/header.h, the command --cut=3 will not succeed.

      The --cut command is always executed before all --rename commands.

    • -C | --cut-all: Remove the largest common initial segment of the paths in <infile>. The option is equivalent to calling -c <depth> with the highest possible value of <depth>.

      The --cut-all command is always executed before all --rename commands. You may either use --cut or --cut-all, not both.

    • -r <command> | --rename=<command>: Rename all paths that match a given pattern.

      The parameter <command> has the form <pattern>,<replacement> or <pattern>,<replacement>,<flags>, where:

      • <pattern> is the pattern to replace. cmedit searches for it in every path in <infile> and tries to replace it with the <replacement> string. If <pattern> occurs more than once in a path, all occurrences are replaced.

        By default, <pattern> uses the wildcard syntax, with ? standing for a single character and * standing for any number of characters. By setting the r flag (see below), one can use regular expression syntax instead. (Note that with regular expressions, the backslashes in Microsoft® Windows path names must be doubled to distinguish them from the backslashes of the regular expression syntax.)

      • <replacement> is the replacement string.
      • <flags> can be the letters i or r or both. The flag i enables case-insensitive comparison, while r enables regular expression matching.
      • Rename all functions that match a given pattern. The patterns are identical to the source file renaming.

      If <pattern> or <replacement> should contain a comma, it can be written as \,.

      The option can be repeated to set more than one <command>. The commands are then executed in sequence in the order in which they are written. But before they are executed, cmedit checks whether the resulting transformation is possible at all. If there are two paths that would be transformed into the same new path, cmedit exits with an error and does nothing.

    • -l | --list-sources: List the paths of all sources in <infile>. The paths are left unchanged.
    • --list-functions: List the names of all functions in <infile> that can be renamed.
    • -I | --case-sensitivity-fix: Rename all source files whose file names are identical but with a different case.
    • -f | --force: Rename source files even if errors are reported.
    • -n | --dry-run: Do not change the paths, only describe what would be done.
    • -v | --verbose: Make the output more verbose.
    • @ <path>: Read command line options from the file at <path> and insert them at the position of this option. The option file is a text file with one option per line. Leading and trailing blanks and empty lines are ignored.

Exit values

cmedit exits with status 0 if it succeeds. It returns -1 if the Coco license is invalid, and 1 if the requested renaming cannot be done.

Coco v7.2.0 ©2024 The Qt Company Ltd.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.