Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit ad1c887

Browse files
authored
Rename method names. (#86)
1 parent 775295b commit ad1c887

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

src/fetch.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ int getCPUtemp(string path)
315315
*/
316316
bool CpuTempCheck()
317317
{
318-
if (Path::of("/sys/class/thermal/thermal_zone1"s).is_directory())
318+
if (Path::of("/sys/class/thermal/thermal_zone1"s).isDirectory())
319319
{
320320
return true;
321321
}
@@ -353,56 +353,56 @@ string getPackages()
353353
{
354354
auto red = Crayon{}.red();
355355
string pkg = "";
356-
if (Path::of("/bin/dpkg"s).is_executable())
356+
if (Path::of("/bin/dpkg"s).isExecutable())
357357
{
358358
auto c = Command::exec("dpkg -l"s);
359359
pkg += to_string(c.getOutputLines()) + red.text(" dpkg; ");
360360
}
361-
if (Path::of("/bin/snap"s).is_executable())
361+
if (Path::of("/bin/snap"s).isExecutable())
362362
{
363363
auto c = Command::exec("snap list"s);
364364
pkg += to_string(c.getOutputLines()) + red.text(" snap; ");
365365
}
366-
if (Path::of("/bin/pacman"s).is_executable())
366+
if (Path::of("/bin/pacman"s).isExecutable())
367367
{
368368
auto c = Command::exec("pacman -Q"s);
369369
pkg += to_string(c.getOutputLines()) + red.text(" pacman; ");
370370
}
371-
if (Path::of("/bin/flatpak"s).is_executable())
371+
if (Path::of("/bin/flatpak"s).isExecutable())
372372
{
373373
auto c = Command::exec("flatpak list"s);
374374
pkg += to_string(c.getOutputLines()) + red.text(" flatpak; ");
375375
}
376-
if (Path::of("/var/lib/rpm"s).is_executable())
376+
if (Path::of("/var/lib/rpm"s).isExecutable())
377377
{
378378
auto c = Command::exec("rpm -qa"s);
379379
pkg += to_string(c.getOutputLines()) + red.text(" rpm; ");
380380
}
381-
if (Path::of("/bin/npm"s).is_executable())
381+
if (Path::of("/bin/npm"s).isExecutable())
382382
{
383383
auto c = Command::exec("npm list"s);
384384
pkg += to_string(c.getOutputLines()) + red.text(" npm; ");
385385
}
386-
if (Path::of("/bin/emerge"s).is_executable()) // gentoo
386+
if (Path::of("/bin/emerge"s).isExecutable()) // gentoo
387387
{
388388
pkg += "not supported"s + red.text(" portage; ");
389389
}
390-
if (Path::of("/bin/xbps-install"s).is_executable()) // void linux
390+
if (Path::of("/bin/xbps-install"s).isExecutable()) // void linux
391391
{
392392
auto c = Command::exec("flatpak list"s);
393393
pkg += to_string(c.getOutputLines()) + red.text(" xbps; ");
394394
}
395-
if (Path::of("/bin/dnf"s).is_executable()) // fedora
395+
if (Path::of("/bin/dnf"s).isExecutable()) // fedora
396396
{
397397
auto c = Command::exec("dnf list installed"s);
398398
pkg += to_string(c.getOutputLines()) + red.text(" dnf; ");
399399
}
400-
if (Path::of("/bin/zypper"s).is_executable()) // opensuse
400+
if (Path::of("/bin/zypper"s).isExecutable()) // opensuse
401401
{
402402
auto c = Command::exec("zypper se --installed-only"s);
403403
pkg += to_string(c.getOutputLines()) + red.text(" zypper; ");
404404
}
405-
if (Path::of("/home/linuxbrew/.linuxbrew/bin/brew"s).is_executable())
405+
if (Path::of("/home/linuxbrew/.linuxbrew/bin/brew"s).isExecutable())
406406
{
407407
auto c = Command::exec("brew list | { tr '' '\n'; }"s);
408408
pkg += to_string(c.getOutputLines()) + red.text(" brew; ");

src/fetch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ class Path
194194
/**
195195
* @returns exists and is a regular file
196196
*/
197-
bool is_regular_file()
197+
bool isRegularFile()
198198
{
199199
return filesystem::is_regular_file(status);
200200
}
201201

202202
/**
203203
* @returns exists and is a executable(or searchable)
204204
*/
205-
bool is_executable()
205+
bool isExecutable()
206206
{
207207
if (status.permissions() == filesystem::perms::unknown)
208208
return false;
@@ -213,15 +213,15 @@ class Path
213213
/**
214214
* @returns exists and is a directory
215215
*/
216-
bool is_directory()
216+
bool isDirectory()
217217
{
218218
return filesystem::is_directory(status);
219219
}
220220

221221
/**
222222
* @returns readable reprsentation for dev.
223223
*/
224-
string to_s()
224+
string toString()
225225
{
226226
return path.string();
227227
}

src/util.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ static void test_Path()
2020
{
2121
// directory
2222
auto p = Path::of("/etc"s);
23-
expect(false, p.is_regular_file(), "test -f "s + p.to_s());
24-
expect(true, p.is_directory(), "test -d "s + p.to_s());
25-
expect(true, p.is_executable(), "test -x "s + p.to_s());
23+
expect(false, p.isRegularFile(), "test -f "s + p.toString());
24+
expect(true, p.isDirectory(), "test -d "s + p.toString());
25+
expect(true, p.isExecutable(), "test -x "s + p.toString());
2626

2727
// executable regular file
2828
p = Path::of("/bin/sh"s);
29-
expect(true, p.is_regular_file(), "test -f "s + p.to_s());
30-
expect(false, p.is_directory(), "test -d "s + p.to_s());
31-
expect(true, p.is_executable(), "test -x "s + p.to_s());
29+
expect(true, p.isRegularFile(), "test -f "s + p.toString());
30+
expect(false, p.isDirectory(), "test -d "s + p.toString());
31+
expect(true, p.isExecutable(), "test -x "s + p.toString());
3232

3333
// non-executable regular file
3434
p = Path::of("Makefile"s);
35-
expect(true, p.is_regular_file(), "test -f "s + p.to_s());
36-
expect(false, p.is_directory(), "test -d "s + p.to_s());
37-
expect(false, p.is_executable(), "test -x "s + p.to_s());
35+
expect(true, p.isRegularFile(), "test -f "s + p.toString());
36+
expect(false, p.isDirectory(), "test -d "s + p.toString());
37+
expect(false, p.isExecutable(), "test -x "s + p.toString());
3838

3939
// not existence path
4040
p = Path::of("not_existence"s);
41-
expect(false, p.is_regular_file(), "test -f "s + p.to_s());
42-
expect(false, p.is_executable(), "test -x "s + p.to_s());
43-
expect(false, p.is_directory(), "test -d "s + p.to_s());
41+
expect(false, p.isRegularFile(), "test -f "s + p.toString());
42+
expect(false, p.isExecutable(), "test -x "s + p.toString());
43+
expect(false, p.isDirectory(), "test -d "s + p.toString());
4444
}
4545

4646
static void test_Crayon()

0 commit comments

Comments
 (0)