{"action":"closed","issue":{"url":"https://api.github.com/repos/DBuildService/dockerfile-parse/issues/2","labels_url":"https://api.github.com/repos/DBuildService/dockerfile-parse/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/DBuildService/dockerfile-parse/issues/2/comments","events_url":"https://api.github.com/repos/DBuildService/dockerfile-parse/issues/2/events","html_url":"https://github.com/DBuildService/dockerfile-parse/issues/2","id":100573599,"number":2,"title":"Support for modifying labels","user":{"login":"twaugh","id":6985468,"avatar_url":"https://avatars.githubusercontent.com/u/6985468?v=3","gravatar_id":"","url":"https://api.github.com/users/twaugh","html_url":"https://github.com/twaugh","followers_url":"https://api.github.com/users/twaugh/followers","following_url":"https://api.github.com/users/twaugh/following{/other_user}","gists_url":"https://api.github.com/users/twaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/twaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twaugh/subscriptions","organizations_url":"https://api.github.com/users/twaugh/orgs","repos_url":"https://api.github.com/users/twaugh/repos","events_url":"https://api.github.com/users/twaugh/events{/privacy}","received_events_url":"https://api.github.com/users/twaugh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"jpopelka","id":288686,"avatar_url":"https://avatars.githubusercontent.com/u/288686?v=3","gravatar_id":"","url":"https://api.github.com/users/jpopelka","html_url":"https://github.com/jpopelka","followers_url":"https://api.github.com/users/jpopelka/followers","following_url":"https://api.github.com/users/jpopelka/following{/other_user}","gists_url":"https://api.github.com/users/jpopelka/gists{/gist_id}","starred_url":"https://api.github.com/users/jpopelka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpopelka/subscriptions","organizations_url":"https://api.github.com/users/jpopelka/orgs","repos_url":"https://api.github.com/users/jpopelka/repos","events_url":"https://api.github.com/users/jpopelka/events{/privacy}","received_events_url":"https://api.github.com/users/jpopelka/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-08-12T15:44:43Z","updated_at":"2015-08-27T16:13:47Z","closed_at":"2015-08-27T16:13:47Z","body":"With the `structure` property it is quite easy to modify most values, by first finding the value to modify, then replacing the lines (known from `startline` and `endline`) in the `lines` property.\r\n\r\nFor example, for CMD:\r\n```\r\nfor insn in parser.structure:\r\n  if insn['instruction'] == 'CMD':\r\n    content = 'CMD my-new-cmd-value\\n'\r\n    lines = parser.lines\r\n    del lines[insn['startline']:insn['endline'] + 1]\r\n    lines.insert(startline, content)\r\n    parser.lines = lines\r\n    break\r\n```\r\n\r\nHowever, for the LABEL instruction it is much more complicated as firstly there are two forms of LABEL, secondly there is quoting to deal with, and thirdly a single LABEL instruction can contain many labels.\r\n\r\nIt would be nice to provide support for modifying a single label, handling all these cases."}}