Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--columns to display customized column order and column widths #15

Open
porg opened this issue Jul 16, 2022 · 2 comments
Open

--columns to display customized column order and column widths #15

porg opened this issue Jul 16, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@porg
Copy link

porg commented Jul 16, 2022

Feature Request

  • Have the possibility to change to column order and column widths of the output with an argument like this:
    --columns "t u p10.(P) e f30.30"

User Goals

  • Often the filepaths and/or process names are very wide, and the total output gets hard to read.
  • I help myself with piping into sed and doing some custom find and replace to shorten filepaths.
  • But it would be desirable if one could do output customization in fatrace itself in a convenient fashion

Principles

  1. Letters correspond to column-names.
  2. Numbers immediately after letter means to truncate that column to that length
    • Special number 0 means: Use the remainder of the available width (if the Terminal defines it).
    • Default truncation: Leave that amount of characters and then cut off the end of the string, with no cutoff character.
      • p10 would shorten like this: "Plex Media Server" → "Plex Media…"
    • Use dots to specify how the truncation is performed
      • After the number like p10. means cut off the start of the string:
        • "Plex Media Server" → "Plex Media…"
      • Before the number like p.10 means cut off the end of the string:
        • "Plex Media Server" → "…dia Server"
      • Between two numbers like f30.30 means to leave the first 30 characters, then show a elipsis "………", then "leave last 30 characters, example:
        • Full column: /srv/disk-id/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
        • Shortened to: /srv/disk-id/Plex/Library/Appl…………com.plexapp.plugins.library.db
  3. All characters other than A-Z, a-z, 0-9 and . are literals (whitespaces, punctuation, special symbols like #, or ;
  4. The column order is defined simply by how you order the column letters within that formatting string.
  5. If you have a t in there but no --timestamp argument the default timestamp format is used.

Explanation of --columns "t u p10.(P) g10.(G) e f30.30"

  • t means timestamp, at full length, because no number is added.
  • u means username, at full length, because no number is added.
  • p means processName, truncated to 10 characters, cut off the end of the string (as the dot is right of the column name). Omitting the dot would have the same effect here, as cutting off the end of the string is the default cutoff.
    • ( is a literal bracket
    • P is the numerical process ID. You could also cutoff here. Makes little sense to me. But maybe there are applications to this.
    • ) is a literal bracket
  • g10.(G) is the same formatting as for p10.(P) but now for g group-name and G group-id.
    • p/P being consistent with u/U and p/P: The uppercase variant being the numerical representation.
  • e the file event(s). Cutoff numbers are ignored. These are any how only 1-2 single capital letters.
  • f is the filepath, 30.30 means to leave the first 30 characters, then show a elipsis "………", then "leave last 30 characters. Using the special width number 0 which means, cut it to the remainder of the available terminal width.
@porg porg changed the title Custom column order and column widths --columns to display customized column order and column widths Jul 16, 2022
@martinpitt martinpitt added the enhancement New feature or request label Jul 17, 2022
@porg
Copy link
Author

porg commented Nov 15, 2022

Any plans for implementation?

@porg
Copy link
Author

porg commented Mar 21, 2023

I updated my proposal with g group-name and G group-id of the file-I/O-process-owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants