-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
CLI: Toggle short ids and mv notebooks for #1728 #6671
Conversation
Based on the commit from DominicLavery@6428e66 add to note list the same. Need for issue laurent22#1728
Fix FolderListWidget view conflict
In my opinion the [solution](laurent22#5191 (comment)) works good. For the ambiguous notebooks you can use `toggle_ids` with `ti` and work with `mv`. The credit goes to kai11 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work so far! After reading through the diff, I have a few (all optional) suggestions. Feel free to ignore any/all of them!
A note about marking comments as resolved
:
Line 42 in 520d974
- **Do not mark your reviewer's comments as "resolved"**. If you do that, the comments will be hidden and the reviewer will not know what are the pending issues in the pull request. Only the reviewer should resolve the comments. |
Feel free to ignore this part of CONTRIBUTING.md
— I don't have the ability to mark the below comments as resolved
.
Compliance with the style guide Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
@personalizedrefrigerator Thanks for your constructive suggestions for improvement. Now i need someone who can approval this PR because from my site i see "1 workflow awaiting approval" (Need a maintainer to approve running workflow) or can i ignore this? Please inform me if i need to do something additionally. (Maybe i have missed something). |
Is it possible that the workflow sporadically does not run properly? |
I think so. Pushing a new commit (e.g. merging in |
Sorry for my questions i am new on the Project honestly, but can we merge this PR? Is something still need from my side? (Awaiting for approval, again) |
@personalizedrefrigerator can you run the workflow again please. |
Strange. I thought I had approved it earlier today but it needs approval again. Approved now. |
Ok, now it maybe my fault. I saw that the PR is still open after the checks have passed successfully. I try to click the button "update" an some one need to approval the workflow again. I don't really understand by what criterion the PR are merged and by whom. I thought the merge is done if the the workflow process are successful. Do I understand it correctly that no more actions are necessary from my side even if the workflow has passed all checks? Optional recommendation. It would be helpful for new people (like me), if the merge process is described in the CONTRIBUTING.md. (Maybe it's an unwritten law and i do not know it) Feel free to ignore it if its so! |
I don't have permission to merge pull requests or grant access to run the automated tests. Code reviews/checks by maintainers are usually done about once every week. If everything looks good when that's done the pull request is generally merged. |
If you're willing to resolve future merge conflicts, you can open a second PR that includes the changes from this one! It can be somewhat difficult to resolve merge conflicts and keep things consistent across branches, though. I generally have one or two development branches. I try to make changes to these branches first, then copy/backport individual changes to a new PR. |
@laurent22 Can you merge it or is anything from my side to do? |
packages/app-cli/app/app-gui.js
Outdated
@@ -375,6 +375,11 @@ class AppGui { | |||
this.showNoteMetadata(!this.widget('noteMetadata').shown); | |||
} | |||
|
|||
toggleNotebookIds() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In code, always use "folder", not "notebook".
packages/app-cli/app/command-mv.js
Outdated
|
||
const notes = await app().loadItems(BaseModel.TYPE_NOTE, pattern); | ||
if (!notes.length) throw new Error(_('Cannot find "%s".', pattern)); | ||
const dstDups = await Folder.search({ titlePattern: destination, limit: 2 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We avoid excessive abbreviations. So at least "destDuplicates"
packages/app-cli/app/command-mv.js
Outdated
if (!notes.length) throw new Error(_('Cannot find "%s".', pattern)); | ||
const dstDups = await Folder.search({ titlePattern: destination, limit: 2 }); | ||
if (dstDups.length > 1) { | ||
throw new Error(_('Ambiguous notebook "%s". Please use notebook id instead - look for parent id in metadata', destination)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this mean "look for parent id in metadata". What concrete action should the user do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, i updated it, it should be clearer now.
packages/app-cli/app/command-mv.js
Outdated
await Note.moveToFolder(notes[i].id, folder.id); | ||
const itemFolder = await app().loadItem(BaseModel.TYPE_FOLDER, pattern); | ||
if (itemFolder) { | ||
const srcDups = await Folder.search({ titlePattern: pattern, limit: 2 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sourceDuplicates
packages/app-cli/app/command-mv.js
Outdated
if (itemFolder) { | ||
const srcDups = await Folder.search({ titlePattern: pattern, limit: 2 }); | ||
if (srcDups.length > 1) { | ||
throw new Error(_('Ambiguous notebook "%s". Please use notebook id instead - look for parent id in metadata or use $b for current', pattern)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
I try to bundle all the works that has been done around the request #1728.
This is a summary of the events:
Respect and thanks to @DominicLavery and @kai11 for their work!
The currently solution looks like this.
Method 1:
Work fine with notebook names
mv folder1 folder2
. As it was described in #5191.If the user try to move the notebook (folder) with
mv folder1 folder3
an error message appears, because there is an ambiguity. See Screenshot.Method 2:
If the title of the notebook is the same you must work with ids.
You press in the joplin cli
ti
for toggle ids an work with the short ids and usemv
for examplemv d82ed 419a0
.If this PR is merged we can go forward with create subnotebooks implementation #1728 .
A good suggestion came from @DominicLavery (#3554).
Again all credit goes to @DominicLavery and @kai11!