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

Proposal: load layout from the external repository #1437

Open
jaeheonji opened this issue May 26, 2022 · 2 comments
Open

Proposal: load layout from the external repository #1437

jaeheonji opened this issue May 26, 2022 · 2 comments
Labels
action Issues related to actions discussion Conversation to figure out actionable steps. Most feature ideas start here. layout issues related to the layout system
Milestone

Comments

@jaeheonji
Copy link
Member

jaeheonji commented May 26, 2022

The idea of this proposal was started with issue #1412

This proposal suggest two main parts.

  • External storage to manage layouts
  • New CLI structure for importing external layouts

Storage of layouts

I think it is good to manage layout storage as a github repository. It is accessible and the user can check the contents through a browser at any time.

Also, users will be able to manage the layout by creating their own private repository. Instead, the layout repository should have a consistent folder structure.

For example:

# https://github.com/zellij-org/zellij-official

root
├── layouts
│   ├── alpha
│   │   ├── custom1.kdl
│   │   └── custom2.kdl
│   ├── bravo
│   │   ├── custom1.kdl
│   │   └── custom2.kdl
│   └── charlie
│       ├── custom1.kdl
│       └── custom2.kdl
└── plugins

Commands

First, I suggest a similar method to the helm CLI. Of course, this kind of command construction is a fairly common method.

What I expect is that users will experience the following:

  1. Users can add, remove, and check a repository, also can search for specific layout.
# show a list of repositories
$ zellij repo list
DEFAULT	NAME		reepository
✔️	zellij-official	https://github.com/zellij-org/zellij-official
	my-private	https://github.com/users/repository

# add a repository
# zellij repo add [NAME] [URL]
$ zellij repo add my-private2 https://github.com/users/repository2

# remove a repository
# zellij repo add [NAME]
$ zellij repo remove my-private2

# zellij repo search [KEYWORD]
# keywords could be the name of a file and a specific tag.
$ zellij repo search custom1 # search the default repo
TYPE    NAME		DESCRIPTION
Layout  alpha/custom1	This is alpha custom1	
Layout  alpha/custom2	This is alpha custom2
Layout  alpha/custom3	This is alpha custom3

$ zellij repo search my-layout --specific-repo my-private

Maybe, tags and descriptions required for the search of layouts can be implemented by setting metadata in KDL.

  1. Apply layouts
# apply local layout
$ zellij layout default

# apply external layout
$ zellij layout --external alpha/custom1
$ zellij layout --external my/layout --specific-repo my-private

Currently, The --layout option is required to apply the layout to zellij, but it seemed good to re-design it as a sub-command if more functions were added.

Anyway, If a user applies a layout from the web, the layout is saved to the local cache folder. And if the user applies the same layout in the future, the saved layout file is loaded.

Other Considerations

  • If zellij supports private storage, we need to think about how to authenticate.

Conclusion

This is a draft made to hear everyone's opinions. Any opinion is fine. If we have a good idea or opinion, we can have a discussion without hesitation.

@jaeheonji jaeheonji added action Issues related to actions discussion Conversation to figure out actionable steps. Most feature ideas start here. layout issues related to the layout system labels May 26, 2022
@jaeheonji jaeheonji added this to the Roadmap milestone May 26, 2022
@imsnif
Copy link
Member

imsnif commented May 28, 2022

I really like this idea. I think doing it with git repositories that you explicitly add rather than a bare URL makes a lot of sense. I think it can also be a great infrastructure for #1392

My only minor nitpick is about:

Anyway, If a user applies a layout from the web, the layout is saved to the local cache folder. And if the user applies the same layout in the future, the saved layout file is loaded.

I understand wanting to cache the layouts and I think it's a good idea not to require network access to run Zellij, but what if the layout is updated in the git repository?

I propose we have an explicit command to do this:

zellij layout --save alpha/custom1 --local-name custom1-from-alpha # --local-name is optional

# later
zellij layout custom1-from-alpha

What do you think?

@jaeheonji
Copy link
Member Author

jaeheonji commented May 29, 2022

I understand wanting to cache the layouts and I think it's a good idea not to require network access to run Zellij, but what if the layout is updated in the git repository?

Good point. Another alternative is to implement a versioning system that includes versions in metadata. Perhaps something like this?

// default.kdl

metadata {
  name "default"
  author "zellij-org"
  version "1.0.0"
  description "This is default layout"
}

template {
  // define the layouts.
}

If a version exists, it seems possible to inform the user whether the layout is updated or not.

I propose we have an explicit command to do this:

zellij layout --save alpha/custom1 --local-name custom1-from-alpha # --local-name is optional
# later
zellij layout custom1-from-alpha

What do you think?

I like it. I think it's good to present explicit commands to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action Issues related to actions discussion Conversation to figure out actionable steps. Most feature ideas start here. layout issues related to the layout system
Projects
None yet
Development

No branches or pull requests

2 participants