MCPcopy Create free account
hub / github.com/idank/explainshell / _get_current_url_distro_release

Function _get_current_url_distro_release

explainshell/web/views.py:53–66  ·  view source on GitHub ↗

Parse the current request path for distro/release segments. Returns (distro, release) if the path starts with /explain/ / /..., otherwise (None, None).

()

Source from the content-addressed store, hash-verified

51
52
53def _get_current_url_distro_release():
54 """Parse the current request path for distro/release segments.
55
56 Returns (distro, release) if the path starts with /explain/<distro>/<release>/...,
57 otherwise (None, None).
58 """
59 path = request.path
60 if not path.startswith("/explain/"):
61 return None, None
62 rest = path[len("/explain/") :]
63 parts = rest.split("/")
64 if len(parts) >= 2 and _is_known_distro(parts[0]):
65 return parts[0], parts[1]
66 return None, None
67
68
69@bp.app_context_processor

Callers 1

inject_distrosFunction · 0.85

Calls 1

_is_known_distroFunction · 0.85

Tested by

no test coverage detected