Skip to content

Issues with running command in shell mode and piping inputs. #858

@ricka-hunt

Description

@ricka-hunt

I'm trying to create a formatter for xan, a csv toolbox which contains a few useful csv formatting functions. They have this atomized design that encourages piping functions into each other.

Here's my current attempt at it:

return {
  meta = {
    url = "https://github.com/medialab/xan",
    description = "The CSV magician",
  },
  command = "xan",
  args = "fixlengths $FILENAME |xan input --trim |xan dedup",
  stdin = false,
}

And the log I get when trying to run it:

          2026-02-27 19:42:36[INFO] Run xan on /home/trickyni/Sync/2026-readlist.csv
          2026-02-27 19:42:36[TRACE] Input lines: { "#,book,Finised?,", "1,EIGHTYSIX- Vol.4,yes,", "2,  EIGHTYSIX- Vol.5,yes", "3,EIGHTYSIX- Vol.6,reading", "3,EIGHTYSIX- Vol.6,reading,", "2,EIGHTYSIX- Vol.7,yes,maybe", "3,,reading," }
          2026-02-27 19:42:36[DEBUG] Creating temp file /home/trickyni/Sync/.conform.4915938.2026-readlist.csv
          2026-02-27 19:42:36[DEBUG] Run command: { "/usr/bin/bash", "-c", "/sbin/xan fixlengths /home/trickyni/Sync/.conform.4915938.2026-readlist.csv |xan input --trim |xan dedup" }
          2026-02-27 19:42:36[DEBUG] Run default CWD: /home/trickyni/Sync
          2026-02-27 19:42:36[DEBUG] xan exited with code 0
          2026-02-27 19:42:36[TRACE] Output lines: { "#,book,Finised?,", "1,EIGHTYSIX- Vol.4,yes,", "2,  EIGHTYSIX- Vol.5,yes", "3,EIGHTYSIX- Vol.6,reading", "3,EIGHTYSIX- Vol.6,reading,", "2,EIGHTYSIX- Vol.7,yes,maybe", "3,,reading," }
          2026-02-27 19:42:36[TRACE] xan stderr: { "" }
          2026-02-27 19:42:36[DEBUG] Cleaning up temp file /home/trickyni/Sync/.conform.4915938.2026-readlist.csv
          2026-02-27 19:42:36[TRACE] Applying formatting to /home/trickyni/Sync/2026-readlist.csv
          2026-02-27 19:42:36[TRACE] Comparing lines { "#,book,Finised?,", "1,EIGHTYSIX- Vol.4,yes,", "2,  EIGHTYSIX- Vol.5,yes", "3,EIGHTYSIX- Vol.6,reading", "3,EIGHTYSIX- Vol.6,reading,", "2,EIGHTYSIX- Vol.7,yes,maybe", "3,,reading," } and { "#,book,Finised?,", "1,EIGHTYSIX- Vol.4,yes,", "2,  EIGHTYSIX- Vol.5,yes", "3,EIGHTYSIX- Vol.6,reading", "3,EIGHTYSIX- Vol.6,reading,", "2,EIGHTYSIX- Vol.7,yes,maybe", "3,,reading," }
          2026-02-27 19:42:36[TRACE] Diff indices {}
          2026-02-27 19:42:36[TRACE] Applying text edits: {}
          2026-02-27 19:42:36[TRACE] Done formatting /home/trickyni/Sync/2026-readlist.csv

If stdin = false it does not seem to make any changes, as shown in the logs.

If stdin = true, saving with ft_on_save on will overwrite all unsaved changes with a formatted version of the initial, pre-save file.

P.S. How does "append_args" work for shell mode? Xan has other tools that could be useful for formatting, but which shouldn't come by default.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions