Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
url-name.hh File Reference

, for some hueristic-ish URL parsing. More...

#include <string>
#include <optional>
#include "lix/libutil/url.hh"

Go to the source code of this file.

Functions

std::optional< std::string > nix::getNameFromURL (ParsedURL const &url)

Detailed Description

, for some hueristic-ish URL parsing.

Function Documentation

◆ getNameFromURL()

std::optional< std::string > nix::getNameFromURL ( ParsedURL const & url)

Try to extract a reasonably unique and meaningful, human-readable name of a flake output from a parsed URL. When nullopt is returned, the callsite should use information available to it outside of the URL to determine a useful name. This is a heuristic approach intended for user interfaces.

Returns
nullopt if the extracted name is not useful to identify a flake output, for example because it is empty or "default". Otherwise returns the extracted name.