(39 lines)
1 '\" t2 .\" Copyright (c) 2025 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Path.extension 3 2025-11-29 "Tomo man-pages"6 .SH NAME7 Path.extension \- get file extension8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Path.extension\ :\ func(path:\ Path,\ full:\ Bool\ =\ yes\ ->\ Text)13 .fi14 .SH DESCRIPTION15 Returns the file extension of the file at the specified path. Optionally returns the full extension.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 path Path The path of the file. -26 full Bool Whether to return everything after the first \fB.\fR in the base name, or only the last part of the extension. yes27 .TE28 .SH RETURN29 The file extension (not including the leading `.`) or an empty text if there is no file extension.31 .SH EXAMPLES32 .EX33 assert (./file.tar.gz).extension() == "tar.gz"34 assert (./file.tar.gz).extension(full=no) == "gz"35 assert (/foo).extension() == ""36 assert (./.git).extension() == ""37 .EE38 .SH SEE ALSO39 .BR Tomo-Path (3)