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

Add command to save graph to disk #4330

Merged
merged 1 commit into from Feb 22, 2022
Merged

Conversation

logseq-cldwalker
Copy link
Collaborator

This PR adds a command to save the current graph to ~/.logseq/graphs. This is useful for power users as it allows them to develop and use applications directly against the datascript db. I'm writing a personal CLI to use an updated datascript db. I added this command because the only other way I saw to persist the db was to quit the app which isn't user friendly

@github-actions github-actions bot added the :type/feature New feature label Feb 21, 2022
:fn (fn [] (state/set-state! :ui/open-select :graph-remove))
:binding false}

:graph/add {:desc "Add a graph"
:fn (fn [] (route-handler/redirect! {:to :repo-add}))
:binding false}

:graph/save {:desc "Save current graph to disk"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mentioned "to disk" because I thought it's helpful for users to understand what save means. I'm open to suggestions on better wording

:fn (fn [] (state/set-state! :ui/open-select :graph-remove))
:binding false}

:graph/add {:desc "Add a graph"
:fn (fn [] (route-handler/redirect! {:to :repo-add}))
:binding false}

:graph/save {:desc "Save current graph to disk"
:fn #(state/pub-event! [:graph/save])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would be nice if users could define commands in config.edn to route to any event. I've updated https://quire.io/w/Logseq-_team_dedicated_to_sport_of_knowledge/189/Define_shortcuts_commands_in_config to capture this

Copy link
Collaborator

@andelf andelf left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@cnrpman cnrpman left a comment

Choose a reason for hiding this comment

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

LGTM

@andelf andelf merged commit 6957b17 into master Feb 22, 2022
@andelf andelf deleted the feat/add-graph-save-command branch February 22, 2022 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:type/feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants