Message ID | 20221117202820.2054593-2-zimon.toutoune@gmail.com |
---|---|
State | New |
Headers | show |
Series | [bug#58660,v2,1/3] etc: teams: Add 'show' subcommand. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git-branch | success | View Git branch |
cbaines/applying patch | success | |
cbaines/issue | success | View issue |
Hello, > + (scope-files > + (fold > + (lambda (str fmt) > + (string-append fmt str)) > + (format #f "scope:~%") > + (sort > + (map (lambda (scope) (format #f "+ ~a~%" scope)) scope-files) Why not: (scope (format #f "scope:~%~{+ ~s ~}~%" scope)) > + string<=?))))) At that point, scope is not always a string: --8<---------------cut here---------------start------------->8--- ERROR: In procedure string<=?: In procedure string<=: Wrong type argument in position 1 (expecting string): #<regexp 7fd842030980> --8<---------------cut here---------------end--------------->8--- Thanks, Mathieu
Hi Mathieu, On Fri, 18 Nov 2022 at 18:23, Mathieu Othacehe <othacehe@gnu.org> wrote: > Why not: > > (scope (format #f "scope:~%~{+ ~s ~}~%" scope)) Because this does not “itemize” correctly. For instance, it outputs: --8<---------------cut here---------------start------------->8--- id: python name: Python team description: Python, Python packages, the "pypi" importer, and the python-build-system. scope: + "gnu/packages/django.scm" + "gnu/packages/jupyter.scm" + #<regexp 7f408800d500> + "gnu/packages/sphinx.scm" + "gnu/packages/tryton.scm" + "guix/build/pyproject-build-system.scm" + "guix/build-system/pyproject.scm" + "guix/build/python-build-system.scm" + "guix/build-system/python.scm" + "guix/import/pypi.scm" + "guix/scripts/import/pypi.scm" + "tests/pypi.scm" members: + Lars-Dominik Braun <lars@6xq.net> + jgart <jgart@dismail.de> --8<---------------cut here---------------end--------------->8--- When what we want is: --8<---------------cut here---------------start------------->8--- scope: + "gnu/packages/django.scm" + "gnu/packages/jupyter.scm" + #<regexp 7f408800d500> + "gnu/packages/sphinx.scm" + "gnu/packages/tryton.scm" + "guix/build/pyproject-build-system.scm" + "guix/build-system/pyproject.scm" + "guix/build/python-build-system.scm" + "guix/build-system/python.scm" + "guix/import/pypi.scm" + "guix/scripts/import/pypi.scm" + "tests/pypi.scm" --8<---------------cut here---------------end--------------->8--- Well, the ’~%’ is included: (scope (format #f "scope:~%~{+ ~s~% ~}~%" scope)))) then there is one extra: --8<---------------cut here---------------start------------->8--- id: python name: Python team description: Python, Python packages, the "pypi" importer, and the python-build-system. scope: + "gnu/packages/django.scm" + "gnu/packages/jupyter.scm" + #<regexp 7f40de756500> + "gnu/packages/sphinx.scm" + "gnu/packages/tryton.scm" + "guix/build/pyproject-build-system.scm" + "guix/build-system/pyproject.scm" + "guix/build/python-build-system.scm" + "guix/build-system/python.scm" + "guix/import/pypi.scm" + "guix/scripts/import/pypi.scm" + "tests/pypi.scm" members: + Lars-Dominik Braun <lars@6xq.net> + jgart <jgart@dismail.de> --8<---------------cut here---------------end--------------->8--- >> + string<=?))))) > > At that point, scope is not always a string: > > --8<---------------cut here---------------start------------->8--- > ERROR: In procedure string<=?: > In procedure string<=: Wrong type argument in position 1 (expecting string): #<regexp 7fd842030980> > --8<---------------cut here---------------end--------------->8--- Hum, I miss how you get that. This, (map (lambda (scope) (format #f "+ ~a~%" scope)) scope-files) transforms all as string. For instance, applying this patch on the top of the introduction of “./etc/teams.scm show”, I get: --8<---------------cut here---------------start------------->8--- id: python name: Python team description: Python, Python packages, the "pypi" importer, and the python-build-system. scope: + #<regexp 7fc05bdd6500> + gnu/packages/django.scm + gnu/packages/jupyter.scm + gnu/packages/sphinx.scm + gnu/packages/tryton.scm + guix/build-system/pyproject.scm + guix/build-system/python.scm + guix/build/pyproject-build-system.scm + guix/build/python-build-system.scm + guix/import/pypi.scm + guix/scripts/import/pypi.scm + tests/pypi.scm members: + Lars-Dominik Braun <lars@6xq.net> + jgart <jgart@dismail.de> --8<---------------cut here---------------end--------------->8--- Cheers, simon
Hi, zimoun <zimon.toutoune@gmail.com> writes: > Hi Mathieu, > > On Fri, 18 Nov 2022 at 18:23, Mathieu Othacehe <othacehe@gnu.org> wrote: > > >> Why not: >> >> (scope (format #f "scope:~%~{+ ~s ~}~%" scope)) > > Because this does not “itemize” correctly. For instance, it outputs: > > id: python > name: Python team > description: Python, Python packages, the "pypi" importer, and the python-build-system. > scope: > + "gnu/packages/django.scm" + "gnu/packages/jupyter.scm" + #<regexp 7f408800d500> + "gnu/packages/sphinx.scm" + "gnu/packages/tryton.scm" + "guix/build/pyproject-build-system.scm" + "guix/build-system/pyproject.scm" + "guix/build/python-build-system.scm" + "guix/build-system/python.scm" + "guix/import/pypi.scm" + "guix/scripts/import/pypi.scm" + "tests/pypi.scm" > members: > + Lars-Dominik Braun <lars@6xq.net> > + jgart <jgart@dismail.de> > > > When what we want is: > > scope: > + "gnu/packages/django.scm" > + "gnu/packages/jupyter.scm" > + #<regexp 7f408800d500> > + "gnu/packages/sphinx.scm" > + "gnu/packages/tryton.scm" > + "guix/build/pyproject-build-system.scm" > + "guix/build-system/pyproject.scm" > + "guix/build/python-build-system.scm" > + "guix/build-system/python.scm" > + "guix/import/pypi.scm" > + "guix/scripts/import/pypi.scm" > + "tests/pypi.scm" > > > Well, the ’~%’ is included: > > (scope (format #f "scope:~%~{+ ~s~% ~}~%" scope)))) > > then there is one extra: > > id: python > name: Python team > description: Python, Python packages, the "pypi" importer, and the python-build-system. > scope: > + "gnu/packages/django.scm" > + "gnu/packages/jupyter.scm" > + #<regexp 7f40de756500> > + "gnu/packages/sphinx.scm" > + "gnu/packages/tryton.scm" > + "guix/build/pyproject-build-system.scm" > + "guix/build-system/pyproject.scm" > + "guix/build/python-build-system.scm" > + "guix/build-system/python.scm" > + "guix/import/pypi.scm" > + "guix/scripts/import/pypi.scm" > + "tests/pypi.scm" > > members: > + Lars-Dominik Braun <lars@6xq.net> > + jgart <jgart@dismail.de> That's fixable with the 'escape' escape, ~^: --8<---------------cut here---------------start------------->8--- (format #f "scope:~%~{+ ~a~^~%~}~%" scope) --8<---------------cut here---------------end--------------->8--- I've reworked your v2, integrating the comments from Mathieu and installed it as 4d7b25a0e2abd77625cdc888c60da8e6add02bbd. Closing!
diff --git a/etc/teams.scm.in b/etc/teams.scm.in index e4e0dc209d..3f90e0e6f2 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -562,7 +562,14 @@ (define width* (%text-width)) "<none>") (match (team-scope team) (() "") - (scope (format #f "scope: ~{~s ~}~%" scope)))) + (scope-files + (fold + (lambda (str fmt) + (string-append fmt str)) + (format #f "scope:~%") + (sort + (map (lambda (scope) (format #f "+ ~a~%" scope)) scope-files) + string<=?))))) (list-members team port* "+ ") (newline)) (if team-names