Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Allow Sub-Components to be Accessed from the Top Level #36

Open
jmwright opened this issue Jan 24, 2019 · 2 comments
Open

Allow Sub-Components to be Accessed from the Top Level #36

jmwright opened this issue Jan 24, 2019 · 2 comments
Assignees

Comments

@jmwright
Copy link
Contributor

Right now the user has to cd down into the directory hierarchy to work with nested components. That's very cumbersome and it's easy to get lost in the hierarchy. The user should be able to access sub-components with .level1.level2.level3 instead of cd ./components/level1/components/level2/coponents/level3 when in the top level component's directory.

This means that dots will be forbidden in component names. Also, it is assumed that local components will take precendence over remote components when there is a naming collision.

@jmwright jmwright self-assigned this Jan 24, 2019
@jmwright
Copy link
Contributor Author

jmwright commented Feb 6, 2019

This should probably come with a tab completion mechanism. It would have to be dynamic for this feature to work, but maybe manipulating an environment variable and then using that in clap-rs scripts would work.

https://www.reddit.com/r/rust/comments/4qvltw/claprs_can_now_generate_bash_tabcompletion/

rust-lang/rustup#278

clap-rs/clap#931

@jmwright
Copy link
Contributor Author

jmwright commented Apr 8, 2019

I think that this is tangentially related to the part.yaml and tools.yaml file handling from this sliderule-rs issue.

When a user runs sr create, they should be able to specify a prefix of parts.xxx or tools.xxx along with a quoted description. The behavior would be as follows.

  • If the prefix (part/tool abstraction) that the user specifies does not exist in the parts.yaml or tools.yaml files, it should be created. For instance running sr create parts.wss "Infineon TLE4996L" with a blank parts.yaml file will create a wss entry, and add an options entry of "infineon_tle4996l" while adding a component to the components directory called infineon_tle4996l.
  • If the prefix does exist in the parts.yaml or tools.yaml file, the component is added as an additional option. For example, running sr create parts.wss "Infineon TLE4996L" with a parts.yaml file that already has a wss entry, will just add infineon_tle4996l at the end of the options list and create infineon_tle4996l in the components directory.

For the create command and all others, if the user specifies a dotted path of components, that should be expanded by the CLI to the correct path to the component. So the following would be equivalent, assuming that the user is starting in a top level component directory.

sr remove level1.level2
sr remove .level1.level2
cd ./components/level1/ && sr remove level2

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

No branches or pull requests

1 participant