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

feat: global alias for included justfile #27

Closed
tepene opened this issue Apr 16, 2023 · 6 comments
Closed

feat: global alias for included justfile #27

tepene opened this issue Apr 16, 2023 · 6 comments
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Comments

@tepene
Copy link

tepene commented Apr 16, 2023

A few days ago I started my journey for a customized ublue project. Thanks for this great "startingpoint" repo! It made my start so easy!!

I started playing around with the provided justfile. First I thought I could just run just from the terminal but that gave me the error error: No justfile found. Should have read the documentation first ;). After doing so I used just --justfile /etc/justfile to get started. But this is cumbersome to use. Thanks to your hint in the documentation I know about include directives, but since this is marked as "currently unstable" I dug a little deeper and found forwarding-alias.

Which brings me to the following suggestion.

Suggestion

Since the provided justfile has commands in it like update and changelogs I thought, wouldn't it be nice to just run ublue update or ublue changelogs etc.

This could be achieved by simply creating a global alias with:

alias ublue="just --justfile /etc/justfile

Possible implementation

To set the global alias I would create ublue-just.sh under /etc/profile.d/ with the mentioned alias in it.

Here an example from my repo:
https://github.com/tepene/ublue-bayou/blob/main/etc/profile.d/ublue-just.sh

Example usage

$ ublue
Available recipes:
    bios
    changelogs
    default
    distrobox-boxkit
    distrobox-debian
    distrobox-opensuse
    distrobox-ubuntu
    setup-pwa-for-edge
    update
    yafti
$ ublue update
echo "Updating system ..."
Updating system ...
rpm-ostree update
note: automatic updates (stage) are enabled
Pulling manifest: ostree-unverified-image:docker://registry.dev.local:5000/ublue-bayou:dev-latest
No upgrade available.
flatpak update -y
Looking for updates…

Nothing to do.
distrobox upgrade -a
 Upgrading ubuntu...
....

What do you think about it? Let me know, i would create a PR if you think my proposal is good for the project.

@castrojo
Copy link
Contributor

The justfile setup is a pain point that's been bugging me for a while. I think longterm what we want is to do a ~/.justfile that does an include of /etc/justfile, so that we could have a system one that we can get updated but the user has one in their home directory for custom commands: https://just.systems/man/en/chapter_52.html

I don't mind doing an alias but perhaps aliasing just itself? I'd like to avoid us having custom commands (which is why we picked just in the first place, heh). What do you think?

@p5
Copy link

p5 commented Apr 16, 2023

@castrojo We could alias just with just --unstable, then I hope we can easily implement calling the ublue-maintained /etc/justfile without the user passing through --unstable manually

@tepene
Copy link
Author

tepene commented Apr 16, 2023

thank you for the clarification. Always good to know about design decisions. 👍

@z0rrn
Copy link

z0rrn commented Apr 17, 2023

If you made custom commands I wouldn't call it ublue. I would include that it's a system maintaining tool, like VanillaOS did with their vso (vanilla-system-operator) or name it like a dedicated package manager.

I would probably call it usm (ublue-system-manager) or systemblue (systemd and ublue connected).

@xynydev
Copy link
Member

xynydev commented Apr 30, 2023

Once this just PR merges, the unstable flag could be added as a envvar in profile.d, making it possible to instruct users to use justfile includes.

@xynydev xynydev added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label May 2, 2023
@xynydev
Copy link
Member

xynydev commented May 20, 2023

just seems to be very slow in updating currently. I have a tested solution, though.

Aliasing alias just='just --unstable' works (mostly) perfectly and just does not nag about it.
The only problem is that the default recipe in main.just errors out.

default:
    @just --list

This can be easily fixed by adding the --unstable flag to the command.

However, this is no longer a matter of the startingpoint repo, but main/config. I'll close this issue and create a new one on another repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

No branches or pull requests

5 participants