aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Path.extension.3
blob: 08d348c8b8ca619ce4f6b7f58ac0bca150c03f2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.extension 3 2025-05-17 "Tomo man-pages"
.SH NAME
Path.extension \- get file extension
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Path.extension\ :\ func(path:\ Path,\ full:\ Bool\ =\ yes\ ->\ Text)
.fi
.SH DESCRIPTION
Returns the file extension of the file at the specified path. Optionally returns the full extension.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
path	Path	The path of the file. 	-
full	Bool	Whether to return everything after the first `.` in the base name, or only the last part of the extension. 	yes
.TE
.SH RETURN
The file extension (not including the leading `.`) or an empty text if there is no file extension.

.SH EXAMPLES
.EX
>> (./file.tar.gz).extension()
= "tar.gz"
>> (./file.tar.gz).extension(full=no)
= "gz"
>> (/foo).extension()
= ""
>> (./.git).extension()
= ""
.EE