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

CLI flag to open file(s) or a directory on Lichtblick #365

Open
wants to merge 24 commits into
base: story/load-multiple-mcaps-r1
Choose a base branch
from

Conversation

ctw-joao-luis
Copy link
Contributor

@ctw-joao-luis ctw-joao-luis commented Feb 8, 2025

User-Facing Changes
With this feature Lichtblick users will be able to open .mcap files directly from the CLI (something that was already possible, but now its doable using the --source= parameter).
What's completely new is the ability to also pass paths to directories and Lichtblick will search for .mcap files inside of it.

Its important to note that, for now, this change will only be available for MCAP files

For instance on Windowns if you pass something like:

lichtblick.exe --source=~/Folder/mcapFile.mcap,~/Folder2/mcapFile2.mcap

Lichtblick will open both files

If you pass something like:

lichtblick.exe --source=~/Folder

Lichblick will search for any .mcap file inside that folder and try to open it.

Description

The command-line arguments are first captured in process.argv and filtered for the --source flag.
If multiple paths are specified, they are split using a comma as a delimiter and converted into absolute paths, handling home directory expansion if necessary. If more than one path is detected, they are treated as separate files and returned as a list. If only one path is provided and it is a directory, the logic attempts to extract .mcap files from it.
This ensures proper handling of both individual files and directories.

image

Checklist

  • The web version was tested and it is running ok
  • The desktop version was tested and it is running ok
  • This change is covered by unit tests
  • Files constants.ts, types.ts and *.style.ts have been checked and relevant code snippets have been relocated

@ctw-joao-luis ctw-joao-luis changed the title CLI flag to open file(s) or a directory with files on Lichtblick CLI flag to open file(s) or a directory on Lichtblick Feb 10, 2025
@ctw-joao-luis ctw-joao-luis added the enhancement New feature or request label Feb 10, 2025
@ctw-joao-luis ctw-joao-luis marked this pull request as ready for review February 13, 2025 12:13
@luluiz luluiz mentioned this pull request Feb 14, 2025
8 tasks
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
75.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@luluiz
Copy link
Member

luluiz commented Feb 14, 2025

#373 implements the tests for the useOpenFile hook

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

Successfully merging this pull request may close these issues.

2 participants