Skip to content

Commit af74510

Browse files
committed
Command execution
1 parent 23c6c41 commit af74510

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ cwd = Path()
15911591

15921592
Command Execution
15931593
-----------------
1594-
### Files and Directories Commands
1594+
### Files and Directories
15951595
* **Paths can be either strings or Path objects.**
15961596
* **All exceptions are either 'OSError' or its subclasses.**
15971597

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ <h3 id="pathlib">Pathlib</h3>
14311431
&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Path without final component.</span>
14321432
</code></pre>
14331433
<h2 id="commandexecution"><a href="#commandexecution" name="commandexecution">#</a>Command Execution</h2>
1434-
<h3 id="filesanddirectoriescommands">Files and Directories Commands</h3>
1434+
<h3 id="filesanddirectories">Files and Directories</h3>
14351435
<ul>
14361436
<li><strong>Paths can be either strings or Path objects.</strong></li>
14371437
<li><strong>All exceptions are either 'OSError' or its subclasses.</strong></li>
@@ -1444,8 +1444,8 @@ <h3 id="filesanddirectoriescommands">Files and Directories Commands</h3>
14441444
os.rmdir(&lt;path&gt;) <span class="hljs-comment"># Deletes empty directory.</span>
14451445
shutil.rmtree(&lt;path&gt;) <span class="hljs-comment"># Deletes the entire directory tree.</span>
14461446
</code></pre>
1447-
<pre><code class="python language-python hljs">os.rename(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Renames the file or directory.</span>
1448-
os.replace(<span class="hljs-keyword">from</span>, to) <span class="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
1447+
<pre><code class="python language-python hljs">os.rename(from, to) <span class="hljs-comment"># Renames the file or directory.</span>
1448+
os.replace(from, to) <span class="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
14491449
</code></pre>
14501450
<pre><code class="python language-python hljs">os.mkdir(&lt;path&gt;, mode=<span class="hljs-number">0o777</span>) <span class="hljs-comment"># Creates a directory.</span>
14511451
&lt;iter&gt; = os.scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns os.DirEntry objects located at path.</span>

parse.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ const DIAGRAM_7_B =
194194
'┃ count() │ │ │ │ ✓ ┃\n' +
195195
'┗━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━┛\n';
196196

197+
const OS_RENAME =
198+
'os.rename(from, to) <span class="hljs-comment"># Renames the file or directory.</span>\n' +
199+
'os.replace(from, to) <span class="hljs-comment"># Same, but overwrites \'to\' if it exists.</span>\n';
200+
197201

198202
function main() {
199203
const html = getMd();
@@ -273,7 +277,8 @@ function highlightCode() {
273277
$('code').each(function(index) {
274278
hljs.highlightBlock(this);
275279
});
276-
fixClasses()
280+
fixClasses();
281+
fixFroms();
277282
}
278283

279284
function setApaches(elements) {
@@ -287,6 +292,10 @@ function fixClasses() {
287292
$('.hljs-class').filter(':contains(class \')').find(':first-child').removeClass('hljs-keyword').addClass('hljs-title')
288293
}
289294

295+
function fixFroms() {
296+
$(`code:contains(os.rename)`).html(OS_RENAME);
297+
}
298+
290299
function readFile(filename) {
291300
try {
292301
return fs.readFileSync(filename, 'utf8');

0 commit comments

Comments
 (0)