LINUX.ORG.RU

История изменений

Исправление theNamelessOne, (текущая версия) :

Чё-то он не может нормально обрабатывать взаимоисключающие флаги. Если включить XML и JSON вывод одновременно, то программа не завершается с ошибкой, а выводит невалидный XML:

<?xml version="1.0" encoding="UTF-8"?>
<tree>
  <directory name=".">
    <directory name="dir1">
      <directory name="subdir1">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
      <directory name="subdir2">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
    </directory>
    <directory name="dir2">
      <directory name="subdir1">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
      <directory name="subdir2">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
    </directory>
  </directory>
  ]}  <report>
    <directories>6</directories>
    <files>8</files>
  </report>
</tree>

А если включить JSON и HTML, то report выводится не текстом, а в JSON:

<!DOCTYPE html>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <meta name="Author" content="Made by 'tree'">
 <meta name="GENERATOR" content="$Version: $ tree v1.8.0 (c) 1996 - 2018 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro $">
 <title>Directory Tree</title>
 <style type="text/css">
  <!--
  BODY { font-family : ariel, monospace, sans-serif; }
  P { font-weight: normal; font-family : ariel, monospace, sans-serif; color: black; background-color: transparent;}
  B { font-weight: normal; color: black; background-color: transparent;}
  A:visited { font-weight : normal; text-decoration : none; background-color : transparent; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:link    { font-weight : normal; text-decoration : none; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:hover   { color : #000000; font-weight : normal; text-decoration : underline; background-color : yellow; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:active  { color : #000000; font-weight: normal; background-color : transparent; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  .VERSION { font-size: small; font-family : arial, sans-serif; }
  .NORM  { color: black;  background-color: transparent;}
  .FIFO  { color: purple; background-color: transparent;}
  .CHAR  { color: yellow; background-color: transparent;}
  .DIR   { color: blue;   background-color: transparent;}
  .BLOCK { color: yellow; background-color: transparent;}
  .LINK  { color: aqua;   background-color: transparent;}
  .SOCK  { color: fuchsia;background-color: transparent;}
  .EXEC  { color: green;  background-color: transparent;}
  -->
 </style>
</head>
<body>
	<h1>Directory Tree</h1><p>
	<a href="base">base</a>{"type":"directory","name": ".","contents":[<br>
	├── <a href="base/dir1/">dir1</a><br>
	│   ├── <a href="base/dir1/subdir1/">subdir1</a><br>
	│   │   ├── <a href="base/dir1/subdir1/file1">file1</a><br>
	│   │   └── <a href="base/dir1/subdir1/file2">file2</a><br>
	│   └── <a href="base/dir1/subdir2/">subdir2</a><br>
	│       ├── <a href="base/dir1/subdir2/file1">file1</a><br>
	│       └── <a href="base/dir1/subdir2/file2">file2</a><br>
	└── <a href="base/dir2/">dir2</a><br>
	    ├── <a href="base/dir2/subdir1/">subdir1</a><br>
	    │   ├── <a href="base/dir2/subdir1/file1">file1</a><br>
	    │   └── <a href="base/dir2/subdir1/file2">file2</a><br>
	    └── <a href="base/dir2/subdir2/">subdir2</a><br>
	        ├── <a href="base/dir2/subdir2/file1">file1</a><br>
	        └── <a href="base/dir2/subdir2/file2">file2</a><br>
  ]}	<br><br>
	</p>
	<p>
,
  {"type":"report","directories":6,"files":8}	<br><br>
	</p>
	<hr>
	<p class="VERSION">
		 tree v1.8.0 © 1996 - 2018 by Steve Baker and Thomas Moore <br>
		 HTML output hacked and copyleft © 1998 by Francesc Rocher <br>
		 JSON output hacked and copyleft © 2014 by Florian Sesser <br>
		 Charsets / OS/2 support © 2001 by Kyosuke Tokoro
	</p>
</body>
</html>

Отписал мейнтейнеру.

Исходная версия theNamelessOne, :

Чё-то он не может нормально обрабатывать взаимоисключающие флаги. Если включить XML и JSON вывод одновременно, то программа не завершается с ошибкой, а выводит невалидный XML:

<?xml version="1.0" encoding="UTF-8"?>
<tree>
  <directory name=".">
    <directory name="dir1">
      <directory name="subdir1">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
      <directory name="subdir2">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
    </directory>
    <directory name="dir2">
      <directory name="subdir1">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
      <directory name="subdir2">
        <file name="file1"></file>
        <file name="file2"></file>
      </directory>
    </directory>
  </directory>
  ]}  <report>
    <directories>6</directories>
    <files>8</files>
  </report>
</tree>

А если включить JSON и HTML, то report выводится не текстом, а JSON:

<!DOCTYPE html>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <meta name="Author" content="Made by 'tree'">
 <meta name="GENERATOR" content="$Version: $ tree v1.8.0 (c) 1996 - 2018 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro $">
 <title>Directory Tree</title>
 <style type="text/css">
  <!--
  BODY { font-family : ariel, monospace, sans-serif; }
  P { font-weight: normal; font-family : ariel, monospace, sans-serif; color: black; background-color: transparent;}
  B { font-weight: normal; color: black; background-color: transparent;}
  A:visited { font-weight : normal; text-decoration : none; background-color : transparent; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:link    { font-weight : normal; text-decoration : none; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:hover   { color : #000000; font-weight : normal; text-decoration : underline; background-color : yellow; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  A:active  { color : #000000; font-weight: normal; background-color : transparent; margin : 0px 0px 0px 0px; padding : 0px 0px 0px 0px; display: inline; }
  .VERSION { font-size: small; font-family : arial, sans-serif; }
  .NORM  { color: black;  background-color: transparent;}
  .FIFO  { color: purple; background-color: transparent;}
  .CHAR  { color: yellow; background-color: transparent;}
  .DIR   { color: blue;   background-color: transparent;}
  .BLOCK { color: yellow; background-color: transparent;}
  .LINK  { color: aqua;   background-color: transparent;}
  .SOCK  { color: fuchsia;background-color: transparent;}
  .EXEC  { color: green;  background-color: transparent;}
  -->
 </style>
</head>
<body>
	<h1>Directory Tree</h1><p>
	<a href="base">base</a>{"type":"directory","name": ".","contents":[<br>
	├── <a href="base/dir1/">dir1</a><br>
	│   ├── <a href="base/dir1/subdir1/">subdir1</a><br>
	│   │   ├── <a href="base/dir1/subdir1/file1">file1</a><br>
	│   │   └── <a href="base/dir1/subdir1/file2">file2</a><br>
	│   └── <a href="base/dir1/subdir2/">subdir2</a><br>
	│   &nbsp;&nbsp;&nbsp; ├── <a href="base/dir1/subdir2/file1">file1</a><br>
	│   &nbsp;&nbsp;&nbsp; └── <a href="base/dir1/subdir2/file2">file2</a><br>
	└── <a href="base/dir2/">dir2</a><br>
	&nbsp;&nbsp;&nbsp; ├── <a href="base/dir2/subdir1/">subdir1</a><br>
	&nbsp;&nbsp;&nbsp; │   ├── <a href="base/dir2/subdir1/file1">file1</a><br>
	&nbsp;&nbsp;&nbsp; │   └── <a href="base/dir2/subdir1/file2">file2</a><br>
	&nbsp;&nbsp;&nbsp; └── <a href="base/dir2/subdir2/">subdir2</a><br>
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ├── <a href="base/dir2/subdir2/file1">file1</a><br>
	&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; └── <a href="base/dir2/subdir2/file2">file2</a><br>
  ]}	<br><br>
	</p>
	<p>
,
  {"type":"report","directories":6,"files":8}	<br><br>
	</p>
	<hr>
	<p class="VERSION">
		 tree v1.8.0 © 1996 - 2018 by Steve Baker and Thomas Moore <br>
		 HTML output hacked and copyleft © 1998 by Francesc Rocher <br>
		 JSON output hacked and copyleft © 2014 by Florian Sesser <br>
		 Charsets / OS/2 support © 2001 by Kyosuke Tokoro
	</p>
</body>
</html>

Отписал мейнтейнеру.