Skip to content

Commit 52fb642

Browse files
author
Nate Nasteff
committed
added conditional to check for other args
1 parent b1982e2 commit 52fb642

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

minify.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/php
2-
<?php # minify.php - Nate Nasteff 2020
2+
<?php # minify.php - CSS minifier for CLI - Nate Nasteff 2020
33

4-
// A simple CSS minifier to be run from the command line.
4+
# If no args are received from CLI or help is requested, print instructions..
55

6-
// If no args are received from CL or help is requested..
7-
8-
if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
6+
if ($argc == 1 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
97

108
?>
119

@@ -20,6 +18,21 @@
2018
<?php
2119
}
2220

21+
// Make sure no second argument gets passed at CLI
22+
// TODO: allow multiple css files at once
23+
24+
elseif ($argc > 2) {
25+
?>
26+
27+
Invalid second argument.
28+
29+
Usage:
30+
minify <foo.css>
31+
32+
<?php
33+
34+
}
35+
2336
else {
2437
// Define needles for stripping newlines and spaces
2538

0 commit comments

Comments
 (0)