Skip to content

put-link should update only specified fields instead of overwriting all fields #34

@mfioretti

Description

@mfioretti

The Usage section of the documentation says that "put-link" "Updates an existing link or note". This is not true. What it does is to transform a link into a private note with a different title. Even the example ("shaarli put-link --private 3252") in the documentation itself shows this.

Also, the inline help says:

(shaarli) [root@fima-01-hetzner ~]# shaarli -c /root/scripts/shaarli.conf   put-link --help
usage: shaarli put-link [-h] [--description DESCRIPTION [DESCRIPTION ...]]
                        [--private] [--tags TAGS [TAGS ...]]
                        [--title TITLE [TITLE ...]] [--url URL]
                        resource

positional arguments:
  resource              Link ID

optional arguments:
  -h, --help            show this help message and exit
  --description DESCRIPTION [DESCRIPTION ...]
                        Link description
  --private             Link visibility
  --tags TAGS [TAGS ...]
                        List of tags associated with the link
  --title TITLE [TITLE ...]
                        Link title
  --url URL             Link URL

but if add and then I try to update a link, it gets changed title, and URL, just like in the docs. But why should they change, if one only sets status to private?:

(shaarli) [marco ~]# shaarli -c shaarli.conf  post-link --url https://www.linux.com --tags "freeSoftware testing" --description "go penguins" --title 'A nice operating system'
{
    "created": "2018-09-04T18:54:08+02:00",
    "description": "go penguins",
    "id": 4,
    "private": false,
    "shorturl": "Gxqflg",
    "tags": [
        "freeSoftware",
        "testing"
    ],
    "title": "A nice operating system",
    "updated": "",
    "url": "https://www.linux.com"
}
(shaarli) [marco ~]# shaarli -c shaarli.conf  put-link --private 4
{
    "created": "2018-09-04T18:54:08+02:00",
    "description": "",
    "id": 4,
    "private": true,
    "shorturl": "Gxqflg",
    "tags": [],
    "title": "?Gxqflg",
    "updated": "2018-09-04T18:54:36+02:00",
    "url": "https://localhost/?Gxqflg"

Besides: "put-link --private true 2" , or e.g "put-link --title 'new title' does not work at all:

(shaarli) [marco ~]# shaarli -c shaarli.conf  put-link --private true 4
usage: shaarli put-link [-h] [--description DESCRIPTION [DESCRIPTION ...]]
                        [--private] [--tags TAGS [TAGS ...]]
                        [--title TITLE [TITLE ...]] [--url URL]
                        resource
shaarli put-link: error: argument resource: true is not a positive integer
(shaarli) [marco ~]# shaarli -c shaarli.conf  put-link --title 'A new title' 4
usage: shaarli put-link [-h] [--description DESCRIPTION [DESCRIPTION ...]]
                        [--private] [--tags TAGS [TAGS ...]]
                        [--title TITLE [TITLE ...]] [--url URL]
                        resource
shaarli put-link: error: argument resource: A new title is not a positive integer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions