Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@andrebauer
Copy link

@andrebauer andrebauer commented Dec 25, 2024

zk config alias lists the aliases in the configuration file.

Closes #253.

@tjex
Copy link
Member

tjex commented Jan 3, 2025

Thanks for this :) Having an initial look at it now. May be a bit slow as I'm starting a new job next week.

My initial thoughts is that it would be good to structure this config.go file in a way that makes it simple to add new config commands.

In line with that I don't think zk config should list out the aliases. It should be zk config --list aliases or something to that effect.

There are no doubt future use cases for zk config ... commands, so starting out with that in mind will pay dividends down the track.

If you're not up for restructuring yourself, not a worry. I can look at it at some point 👍

This is excellent ground work as it is :) Thanks again.

A secondary thought could be to refactor the logic for cmd.header, cmd.delimter, etc into a function somewhere instead of copying from cmd.List. But maybe thats too soon of an optimization.

@andrebauer
Copy link
Author

andrebauer commented Jan 3, 2025

I have reworked the zk config so that zk config --list OBJECT now list the aliases, filters or extras. For further improvements I ask you to give me more specific suggestions.

Especially for the copied logic from cmd.List, the question would be to which file that should be transferred. But this may already be a separate issue?

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity.

@github-actions github-actions bot added the stale No recent activity label Apr 18, 2025
@tjex tjex changed the base branch from main to dev November 23, 2025 17:05
@tjex tjex removed the stale No recent activity label Nov 23, 2025

# Print aliases as json.
$ zk config --list aliases --format=json
>[{"conf":"$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml""},{"editlast":"zk edit --limit 1 --sort modified- $@"},{"hist":"zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"},{"list":"zk list --quiet $@"},{"ls":"zk list $@"},{"lucky":"zk list --quiet --format full --sort random --limit 1"},{"path":"zk list --quiet --format \{{path}} --delimiter , $@"},{"recent":"zk edit --sort created- --created-after 'last two weeks' --interactive"}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"conf":"$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml""

Quotes here don't make sense. This is not valid JSON.

}

var defaultMapFormats = map[string]string{
"json": `{"%s":"%s"}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use go's native JSON formatting capabilities, this doesn't properly escape items.

@WhyNotHugo
Copy link
Contributor

Unless others have strong feelings about this, I think we can do without jsonl formatting to keep complexity down.

@tjex
Copy link
Member

tjex commented Dec 3, 2025

@WhyNotHugo Fine by me 👍

andrebauer and others added 18 commits December 26, 2025 21:54
…guration objects like aliases, filters or extras.
This is an empty commit.
It serves to notify that ALOT of commits were made in fixing
the GitHub CI for this release.

The last notable commit before all this noise was: 2f8be08
…guration objects like aliases, filters or extras.
…guration objects like aliases, filters or extras.
@andrebauer
Copy link
Author

@WhyNotHugo Thanks for your review, I've adjusted my PR.

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.

Feature Request: Command to list all aliases

3 participants