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

Multiple prepend files #317

Closed

Conversation

SchrodingersGat
Copy link

@SchrodingersGat SchrodingersGat commented May 25, 2023

  • Allow prepending of multiple template files
  • Refactor code to use parse_file() function

This PR adds the ability to provide multiple prepend files which is handy if you have multiple template files that you want to re-use across different projects.

Additionally it fixes a small bug where the program will error if the prepended file does not end with a newline

Example

Command

wireviz harness.yml --prepend-file input_a.yml input_b.yml

input_a.yml

templates:
  - &conn_a
    type: Connector A
    pn: CONN-A
    additional_components:
      - 
        type: Crimp A
        pn: CRIMP-A
        qty_multiplier: populated

input_b.yml

templates:
  - &conn_b
    type: Connector B
    pn: CONN-B
    additional_components:
      - 
        type: Crimp B
        pn: CRIMP-B
        qty_multiplier: populated

harness.yml

connectors:
  J1:
    <<: *conn_a
    pinlabels: [GND, POWER, SIGNAL]
    pincount: 3

  J2:
    <<: *conn_b
    pinlabels: [GND, SIGNAL, POWER]
    pincount: 3
  
cables:
  W1:
    gauge: 26 AWG
    wirecount: 8

connections:
  -
    - J1: [1-3]
    - W1: [1, 5, 8]
    - J2: [1, 3, 2]

Output File

image

- Allow prepending of multiple template files
- Refactor code to use parse_file() function
@SchrodingersGat SchrodingersGat changed the base branch from dev to master May 25, 2023 02:50
@kvid
Copy link
Collaborator

kvid commented Jul 17, 2023

Thank you for this contribution, @SchrodingersGat. I'm sorry that your PR has been unanswered until now. Several older PRs have just recently been merged into the dev branch (see #316 for a description), and it seems that code already supports multiple prepend files.

Please try the current dev branch, and compare it with your own implementation. If your new functionality is fully present in the current dev branch, then this PR is now obsolete, but if your contributions might have some extra advantages, then feel free to create a new PR for that, but please use dev (not master) as the PR base branch.

@SchrodingersGat
Copy link
Author

@kvid thanks for the response. If this feature is now included, I'll close this out. Glad to see that wireviz is receiving some attention again :)

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

Successfully merging this pull request may close these issues.

2 participants